JavaScript Vim script
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
.vimrc
LICENCE
README.md
package.json

README.md

#MIME Part Stream

Travis CI Test Status

Pipe data in to this transform stream and receive an encoded MIME part for a multipart MIME block.

npm install mime-part-stream

To use:

var mimePartStream = require('mime-part-stream');
fs.createReadStream('logo.png').pipe(mimePartStream({
  type: 'image/png',
  transferEncoding: 'base64'
}).pipe(res);

When initialising a new stream, there are 2 options available in the options object:

  • type: this should be a valid MIME type eg. 'text/plain; charset=UTF-8' or 'application/pdf'
  • transferEncoding: base64 and quoted-printable are the 2 available options; defaults to no encoding
  • headers: optional object containing header key value pairs

Note that you should append '; charset=UTF-8' with any text/ MIME-types