Skip to main content Link Search Menu Expand Document (external link)

NodeStream overview

Added in v1.0.0


Table of contents


combinators

pipeThroughDuplex

Signature

export declare const pipeThroughDuplex: {
  <E2, B = Uint8Array>(
    duplex: LazyArg<Duplex>,
    onError: (error: unknown) => E2,
    options?: (FromReadableOptions & FromWritableOptions) | undefined
  ): <R, E, A>(self: Stream<A, E, R>) => Stream<B, E2 | E, R>
  <R, E, A, E2, B = Uint8Array>(
    self: Stream<A, E, R>,
    duplex: LazyArg<Duplex>,
    onError: (error: unknown) => E2,
    options?: (FromReadableOptions & FromWritableOptions) | undefined
  ): Stream<B, E | E2, R>
}

Added in v1.0.0

pipeThroughSimple

Signature

export declare const pipeThroughSimple: {
  (duplex: LazyArg<Duplex>): <R, E>(self: Stream<string | Uint8Array, E, R>) => Stream<Uint8Array, E | PlatformError, R>
  <R, E>(self: Stream<string | Uint8Array, E, R>, duplex: LazyArg<Duplex>): Stream<Uint8Array, PlatformError | E, R>
}

Added in v1.0.0

constructors

fromDuplex

Signature

export declare const fromDuplex: <IE, E, I = Uint8Array, O = Uint8Array>(
  evaluate: LazyArg<Duplex>,
  onError: (error: unknown) => E,
  options?: FromReadableOptions & FromWritableOptions
) => Channel<Chunk<O>, Chunk<I>, IE | E, IE, void, unknown>

Added in v1.0.0

fromReadable

Signature

export declare const fromReadable: <E, A = Uint8Array>(
  evaluate: LazyArg<Readable | NodeJS.ReadableStream>,
  onError: (error: unknown) => E,
  { chunkSize }?: FromReadableOptions
) => Stream<A, E>

Added in v1.0.0

fromReadableChannel

Signature

export declare const fromReadableChannel: <E, A = Uint8Array>(
  evaluate: LazyArg<Readable | NodeJS.ReadableStream>,
  onError: (error: unknown) => E,
  chunkSize: number | undefined
) => Channel<Chunk<A>, unknown, E, unknown, void, unknown>

Added in v1.0.0

conversions

toReadable

Signature

export declare const toReadable: <E, R>(stream: Stream<string | Uint8Array, E, R>) => Effect<Readable, never, R>

Added in v1.0.0

toReadableNever

Signature

export declare const toReadableNever: <E>(stream: Stream<string | Uint8Array, E, never>) => Readable

Added in v1.0.0

toString

Signature

export declare const toString: <E>(
  readable: LazyArg<Readable | NodeJS.ReadableStream>,
  options: {
    readonly onFailure: (error: unknown) => E
    readonly encoding?: BufferEncoding | undefined
    readonly maxBytes?: SizeInput | undefined
  }
) => Effect<string, E>

Added in v1.0.0

toUint8Array

Signature

export declare const toUint8Array: <E>(
  readable: LazyArg<Readable | NodeJS.ReadableStream>,
  options: { readonly onFailure: (error: unknown) => E; readonly maxBytes?: SizeInput | undefined }
) => Effect<Uint8Array, E>

Added in v1.0.0

model

FromWritableOptions (interface)

Signature

export interface FromWritableOptions {
  readonly endOnDone?: boolean
  readonly encoding?: BufferEncoding
}

Added in v1.0.0

models

FromReadableOptions (interface)

Signature

export interface FromReadableOptions {
  /** Defaults to undefined, which lets Node.js decide the chunk size */
  readonly chunkSize?: SizeInput
}

Added in v1.0.0