Permalink
Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (27 sloc) 955 Bytes
node-multipart
==============
A simple multipart message creation utility for Node.js, that has a nice stream-like interface.
Install
-------
npm install multipart
Usage
-----
For a brief introduction to the api, take a look at test/simple.js. Otherwise:
var multipart = require('multipart')
// Create the stream object using the provided factory.
var my_mp_stream = multipart.createMultipartStream()
// Pipe the multipart message to stdout.
my_mp_stream.pipe(process.stdout)
// Write some stuff to the multipart stream. Take a look in test/ and index.js
// for more options and gimmicks.
my_mp_stream.write(
{ 'Content-Disposition' : 'form-data; name="files"'
, 'Content-Type' : another_mp_stream.contentType(my_mp_stream)
}
, another_mp_stream
, function () {
console.log('FILESWRITTEN')
}
)
// Tie up the loose ends.
my_mp_stream.end(end_cb_fn)