This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node: v0.10.21 | |
// request: 2.27.0 | |
var request = require('request'); | |
var fs = require('fs'); | |
var r = request.post("http://server.com:3000/"); | |
// See http://nodejs.org/api/stream.html#stream_new_stream_readable_options | |
// for more information about the highWaterMark | |
// Basically, this will make the stream emit smaller chunks of data (ie. more precise upload state) | |
var upload = fs.createReadStream('f.jpg', { highWaterMark: 500 }); |