Integration with MapBox upload API.
Library for interfacing with the Mapbox upload API.
A Mapbox API token is required for authentication. Generate a secret token
uploads:write scope enabled by following
$ npm install --save mapbox-upload
var upload = require'mapbox-upload';// creates a progress-stream object to track status of// upload while upload continues in backgroundvar progress = uploadfile: __dirname + '/test.mbtiles' // Path to mbtiles file on disk.account: 'test' // Mapbox user account.accesstoken: 'validtoken' // A valid Mapbox API secret token with the uploads:write scope enabled.mapid: 'test.upload' // The identifier of the map to create or update.;progresson'error'if err throw err;;progresson'progress'// Do something with progress-stream object, like display upload status;progressonce'finished'// Upload has completed but is likely queued for processing and not yet available on Mapbox.;
stream object can be passed in instead of
length option is recommended for accurate progress-stream reporting. If length is unknown, it can be updated after upload has begun by emitting a
length event from the
$ npm install --global mapbox-upload$ export MapboxAccessToken=<access token with uploads:write scope enabled>$ mapbox-upload username.dataid /path/to/file
See also: USAGE.txt
tests require env variables
AWS_SECRET_ACCESS_KEY to generate test credentials