Skip to content

Instantly share code, notes, and snippets.

@yaasita
Created June 15, 2014 03: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 yaasita/e43280051bf9c52e198f to your computer and use it in GitHub Desktop.
Save yaasita/e43280051bf9c52e198f to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
var Tumblr = require('tumblrwks');
var fs = require('fs');
var tumblr = new Tumblr(
{
consumerKey: 'xxxxxxxxxxxxx',
consumerSecret: 'xxxxxxxxxxxxxx',
accessToken: 'xxxxxxxxxxxxxx',
accessSecret: 'xxxxxxxxxxxxxx'
}, "hoge.tumblr.com"
);
var upload_file = fs.readFileSync(process.argv[2]);
tumblr.post('/post', {type: 'photo', data: [upload_file]}, function(err, json){
console.log(json);
tumblr.get('/posts', {limit:1, type: 'photo'}, function(err,json){
console.log(json.posts[0].post_url);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment