node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org ยป


MIME Multipart Stream

Travis CI Test Status

Creates a readable stream composed of multiple MIME parts to be injected into an overall email

npm install mime-multipart-stream

To use:

var stream = mimeMultipartStream({
  boundary: '1234567890',
  type: 'alternative'
  type: 'text/plain; charset=UTF-8',
  transferEncoding: 'quoted-printable',
  body: textPlainStream
  type: 'text/html; charset=UTF-8',
  transferEncoding: 'quoted-printable',
  body: textHtmlStream

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

  • type: This should be one of the valid multipart subtypes eg. mixed, alternative.
  • boundary: This should be a an ASCII boundary string that is used to generate the MIME separators between each MIME part.

Once you have created your stream, use the add method to add multiple readable streams. Each stream is added using the initialisation options found in the mime-part-stream (GitHub) module.

Once ready, use the standard readable streams API to consume the content.