JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 132435
  • Score
    100M100P100Q171247F

A readable stream that concatenates multiple streams with optional head, tail & join buffers

Package Exports

  • sandwich-stream

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sandwich-stream) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

SandwichStream

Travis CI Test Status

While I'm not overjoyed about how performant the internals will operate, I wanted a readable stream that was ACTUALLY A READABLE STREAM. Not a streams1 stream masquerading as streams2. As soon as somebody writes a better concat stream as a readable stream with a nice simple API, this baby is going to develop some serious abandonment issues.

Installation

npm install sandwich-stream

Usage

var sandwichStream = require('sandwich-stream');
var ss = sandwichStream({
  head: 'Thing at the top\n',
  tail: '\nThing at the bottom',
  separator: '\n ---- \n'
});
ss.add(aStreamIPreparedEarlier);
ss.add(anotherStreamIPreparedEarlier);
ss.add(aFurtherStreamIPreparedEarlier);
ss.pipe(process.stdout);

// The thing at the top
//  ---- 
// Stream1
//  ---- 
// Stream2
//  ---- 
// Stream3
// The thing at the bottom

The head option takes a string/buffer and pushes the string before all other content

The foot option takes a string/buffer and pushes the string after all other data has been pushed

The separator option pushes a string/buffer between each stream

Too add a stream use the .add method: ss.add(streamVariable);