mikeal/request — Issue #154: Streaming File Uploads
Author: iammerrick
Created: 2012-01-12 22:52:41+00:00
State: open

I am looking to take a string of text and upload as a file without writing it to disk. My first (pathetic) attempts at this look something like this:

```javascript

var Stream = require('stream');

new Stream()
.pipe(request.put({
uri: 'http://placetoupload',
headers: {
'content-type' : 'multipart/form-data'
}
}, function(error, response, body){
if (error) {
console.log('ERROR: ' + error);
}
if (!error && response) {
deferred.resolve(response, body);
}
}))
.write(csv);
```

I apologize for my ignorance, but I'd love to learn the proper way to do this with request, without writing the file to disk. The file being the string `csv`. Thanks!