Created
May 20, 2015 21:56
-
-
Save tmcw/f08f2b811a55c2c9156b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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