Skip to content

Instantly share code, notes, and snippets.

@toanalien
Created September 25, 2015 16:21
Show Gist options
  • Save toanalien/718b415ccc89f008d180 to your computer and use it in GitHub Desktop.
Save toanalien/718b415ccc89f008d180 to your computer and use it in GitHub Desktop.
var fs = require('fs');
var request = require('request');
var Box = require('./controllers/BoxControllers');
var box = new Box({
access_token: "duPlRu6eWRWJ42sIEb6Mlc2fUdjx4uRL",
refresh_token: "mPZjuJZxqitdfbSWO7TU2IgxmXuZvF4Ge0bB328jCnL3h3SvMQpmobKx93xajUEi"
});
request.post('https://upload.box.com/api/2.0/files/content', {
headers: {
Authorization: "Bearer duPlRu6eWRWJ42sIEb6Mlc2fUdjx4uRL"
},
formData: {
attributes: {
name: "app.js",
parent: {
id: 0
}
},
file: fs.createReadStream('abc.txt')
}
}, function(err, res, body) {
//
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment