A readable stream that concatenates multiple streams with optional head, tail & join buffers
npm install sandwich-stream







bash
npm install sandwich-stream --save
`note: this code was made using it TypeScript, and its typings are linked in package.json, so there's no need of installing _@types/sandwich-stream_ or anything related.
Usage
`typescript
import { SandwichStream } from 'sandwich-stream';
// OR EVEN:
// const SandwichStream = require('sandwich-stream');const sandwich = SandwichStream({
head: 'Thing at the top\n',
tail: '\nThing at the bottom',
separator: '\n ---- \n'
});
sandwich.add(aStreamIPreparedEarlier)
.add(anotherStreamIPreparedEarlier)
.add(aFurtherStreamIPreparedEarlier)
.pipe(process.stdout);
// The thing at the top
// ----
// Stream1
// ----
// Stream2
// ----
// Stream3
// The thing at the bottom
`
Configuration Options
* head option takes a string/buffer and pushes the string before all other content
* foot option takes a string/buffer and pushes the string after all other data has been pushed
* separator option pushes a string/buffer between each stream
* Readable Options can also be passed through.API
Too add a stream use the .add method: sandwich.add(streamVariable);`