Easily perform programmatic multi-part file uploads. Designed for use within test suites.
var uploader = require('file-uploader')
var file // set to the path of the file you want to upload
var cookie // set a cookie if you require authorisation
var options = {
host : 'localhost',
port : 4000,
path : '/upload',
method : 'POST',
encoding : 'utf8'
}
uploader.postFile(options, file, {Cookie: cookie}, function(err, res) {
console.log(res.statusCode)
})
Originally inspired by Anand Prakash.