Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created May 20, 2015 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/f08f2b811a55c2c9156b to your computer and use it in GitHub Desktop.
Save tmcw/f08f2b811a55c2c9156b to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
var got = require('got'),
fs = require('fs'),
argv = require('minimist')(process.argv.slice(2));
var API = 'https://www.mapbox.com/core/api/Markers/';
if (!process.env.MapboxAccessToken) throw new Error('MapboxAccessToken env variable required');
if (argv._.length !== 2) throw new Error('mapid & file arguments required');
got.put(API + argv._[0] + '?access_token=' + process.env.MapboxAccessToken, {
body: fs.readFileSync(argv._[1], 'utf8'),
headers: {
'Content-Type': 'application/json'
}
}, function(err, res) {
console.log(res);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment