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 = ;// creates a progress-stream object to track status of// upload while upload continues in backgroundvar progress =;progress;progress;progress;
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
Using the CLI will also require generating a secret token with the
uploads:write scope enabled.
$ npm install --global mapbox-upload $ export MapboxAccessToken=<access token with uploads:write scope enabled> $ mapbox-upload username.dataid /path/to/file
CLI usage follows the following pattern:
mapbox-upload <dataset> [<filepath> | <url>]
datasetrefers to the id of the dataset or map being created or replaced.
urlrefers to either:
- a local file
- a remote file on S3
Creating a new file might look like:
mapbox-upload <your-username>.create example.tif
Updating an existing file would look the same, except that you would pass
in an existing
tests require env variables
AWS_SECRET_ACCESS_KEY to generate test credentials