Socket
Socket
Sign inDemoInstall

sandwich-stream

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sandwich-stream

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


Version published
Weekly downloads
59K
decreased by-13.58%
Maintainers
1
Weekly downloads
 
Created
Source

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);

FAQs

Package last updated on 09 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc