You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 2, 2021. It is now read-only.
Library for interfacing with the Mapbox upload API.
⚠️ This library is no longer maintained or accepting feature requests. For a more robust and up-to-date Mapbox CLI, we recommend using mapbox-cli-py, which provides access to uploads and other services. If you're interested in a node.js interface, the mapbox-sdk-js uploader is your friend.
Authentication
A Mapbox API token is required for authentication. Generate a secret token
with the uploads:write scope enabled by following
these steps.
JavaScript Usage
$ npm install --save mapbox-upload
varupload=require('mapbox-upload');// creates a progress-stream object to track status of// upload while upload continues in backgroundvarprogress=upload({file: __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.name: 'My upload'// Optional name to set, otherwise a default such as original.geojson will be used.});progress.on('error',function(err){if(err)throwerr;});progress.on('progress',function(p){// Do something with progress-stream object, like display upload status});progress.once('finished',function(){// Upload has completed but is likely queued for processing and not yet available on Mapbox.});
Options
stream
A stream object can be passed in instead of {file: filepath}.
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 stream object.