secret
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 apiUrl = 'http://api.flickr.com/services/upload/';
 
var filenames = fs.readdirSync(path);
filenames.forEach(function(filename) {
// 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', function() {
console.log('Sent file ' + filename);
});
});
console.log('Finished!');

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.