public
Created

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
var fs = require('fs');
var request = require('request');
var async = require('async');
var apiUrl = 'http://api.flickr.com/services/upload/';
 
var filenames = fs.readdirSync(path);
async.forEach(filenames, function(filename, callback) {
// open a file stream on the local image
var fileStream = fs.createReadStream(path + filename);
// read from the file and write to the HTTP request
fileStream.pipe(request.post(apiUrl));
fileStream.on('end', callback);
}, function(err) {
console.log(err ? err.message : 'Finished!');
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.