@types/event-stream

  • Version 4.0.5
  • Published
  • 7.49 kB
  • 1 dependency
  • MIT license

Install

npm i @types/event-stream
yarn add @types/event-stream
pnpm add @types/event-stream

Overview

TypeScript definitions for event-stream

Index

Functions

function child

child: (child_process: any) => MapStream;
  • Create a through stream from a child process

    Parameter child_process

function concat

concat: {
(...stream: MapStream[]): MapStream;
(streamArray: MapStream[]): MapStream;
};
  • Merges streams into one and returns it. Incoming data will be emitted as soon it comes into - no ordering will be applied (for example: data1 data1 data2 data1 data2 - where data1 and data2 is data from two streams). Counts how many streams were passed to it and emits end only when all streams emitted end.

    Parameter stream

function duplex

duplex: (writeStream: stream.Writable, readStream: stream.Readable) => MapStream;
  • Takes a writable stream and a readable stream and makes them appear as a readable writable stream.

    Parameter writeStream

    Parameter readStream

function filterSync

filterSync: (syncFunction: (value: any) => boolean) => MapStream;
  • Filter elements of the stream.

    Parameter syncFunction

function join

join: (separator: string) => MapStream;
  • Create a through stream that emits separator between each chunk, just like Array#join

    Parameter separator

function map

map: (asyncFunction: Function) => MapStream;
  • Create a through stream from an asynchronous function

    Parameter asyncFunction

function mapSync

mapSync: (syncFunction: Function) => MapStream;
  • Same as map, but the callback is called synchronously. Based on es.through

    Parameter syncFunction

function merge

merge: {
(...stream: MapStream[]): MapStream;
(streamArray: MapStream[]): MapStream;
};
  • Merges streams into one and returns it. Incoming data will be emitted as soon it comes into - no ordering will be applied (for example: data1 data1 data2 data1 data2 - where data1 and data2 is data from two streams). Counts how many streams were passed to it and emits end only when all streams emitted end.

    Parameter stream

function parse

parse: () => any;
  • Convenience function for parsing JSON chunks. For newline separated JSON, use with es.split. By default it logs parsing errors by console.error; for another behaviour, transforms created by es.parse({error: true}) will emit error events for exceptions thrown from JSON.parse, unmodified.

function pause

pause: () => MapStream | void;
  • A stream that buffers all chunks when paused

function pipeline

pipeline: (...streams: MapStream[]) => MapStream;
  • Create a stream from a series of MapStreams

function readable

readable: (asyncFunction: Function) => MapStream;
  • create a readable stream (that respects pause) from an async function.

    Parameter asyncFunction

function readArray

readArray: (array: any[]) => MapStream;
  • Create a readable stream from an Array.

    Parameter array

function replace

replace: (from: string | RegExp, to: string | RegExp) => MapStream;
  • Replace all occurrences of from with to

    Parameter from

    Parameter to

function split

split: (matcher?: string | RegExp) => MapStream;
  • Break up a stream and reassemble it so that each line is a chunk. matcher may be a String, or a RegExp

    Parameter matcher

function stringify

stringify: () => MapStream;
  • convert javascript objects into lines of text. The text will have whitespace escaped and have a \n appended, so it will be compatible with es.parse

function wait

wait: (callback: Function) => MapStream;
  • waits for stream to emit 'end'. joins chunks of a stream into a single string or buffer. Takes an optional callback, which will be passed the complete string/buffer when it receives the 'end' event.

    Parameter callback

function writeArray

writeArray: (callback: Function) => MapStream;
  • create a writeable stream from a callback

    Parameter callback

Interfaces

interface MapStream

interface MapStream extends stream.Stream {}

    property destroy

    destroy: () => void;

      property end

      end: any;

        property pause

        pause: () => void;

          property readable

          readable: boolean;

            property resume

            resume: () => void;

              property writable

              writable: boolean;

                property write

                write: any;

                  Package Files (1)

                  Dependencies (1)

                  Dev Dependencies (0)

                  No dev dependencies.

                  Peer Dependencies (0)

                  No peer dependencies.

                  Badge

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

                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/event-stream.

                  • Markdown
                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/event-stream)
                  • HTML
                    <a href="https://www.jsdocs.io/package/@types/event-stream"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>