ArcGIS API for JavaScript: flow_direction_raster (MapServer)
Built using the ArcGIS API for JavaScript