• Version 2.0.2
  • Published
  • 24.3 kB
  • No dependencies
  • Apache-2.0 license


npm i sandwich-stream
yarn add sandwich-stream
pnpm add sandwich-stream


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



class SandwichStream

class SandwichStream extends Readable {}
  • Handles Readable streams requests as concatenation through data handling as well adding tags it each begin, end and between of the streams


constructor({ head, tail, separator, ...remaining }: SandwichOptions);
  • Initiates the SandwichStream, you can consider it also passing ReadableOptions to it

    Parameter head

    Pushes this content before all other content

    Parameter tail

    Pushes this content after all other data has been pushed

    Parameter separator

    Pushes this content between each stream

    Parameter remaining

    The other kind of options to be passed to Readable

    Example 1

    const ss = new SandwichStream({ head: 'This at the top\n', tail: '\nThis at the bottom', separator: '\n --- \n' });

method add

add: (newStream: Readable) => this;
  • Add a new Readable stream in the queue

    Parameter newStream

    The Readable stream


    This instance of Sandwich Stream


    An Error in case that this request was not accepted

    Example 1

    sandwichStream.add(streamOne); sandwichStream.add(streamTwo); sandwichStream.add(streamThree);


interface SandwichOptions

interface SandwichOptions extends ReadableOptions {}
  • Sandwich Options that will configure parsed data

property head

readonly head?: string | Buffer;

    property separator

    readonly separator?: string | Buffer;

      property tail

      readonly tail?: string | Buffer;

        Package Files (1)

        Dependencies (0)

        No dependencies.

        Dev Dependencies (14)

        Peer Dependencies (0)

        No peer dependencies.


        To add a badge like this badgeto your package's README, use the codes available below.

        You may also use to create a custom badge linking to

        • Markdown
        • HTML
          <a href=""><img src="" alt=""></a>