https://github.com/tim-smart/node-multipart
Multipart stream encoder for node.js
https://github.com/tim-smart/node-multipart
Last synced: 9 months ago
JSON representation
Multipart stream encoder for node.js
- Host: GitHub
- URL: https://github.com/tim-smart/node-multipart
- Owner: tim-smart
- License: mit
- Created: 2012-01-25T22:30:00.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2014-06-15T23:40:33.000Z (about 12 years ago)
- Last Synced: 2025-04-05T10:51:12.294Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 136 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
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)