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

Ndjson overview

Added in v1.0.0


Table of contents


combinators

duplex

Signature

export declare const duplex: {
  (
    options?: NdjsonOptions
  ): <R, IE, OE, OutDone, InDone>(
    self: Channel.Channel<Chunk.Chunk<Uint8Array>, Chunk.Chunk<Uint8Array>, OE, IE | NdjsonError, OutDone, InDone, R>
  ) => Channel.Channel<Chunk.Chunk<unknown>, Chunk.Chunk<unknown>, NdjsonError | OE, IE, OutDone, InDone, R>
  <R, IE, OE, OutDone, InDone>(
    self: Channel.Channel<Chunk.Chunk<Uint8Array>, Chunk.Chunk<Uint8Array>, OE, IE | NdjsonError, OutDone, InDone, R>,
    options?: NdjsonOptions
  ): Channel.Channel<Chunk.Chunk<unknown>, Chunk.Chunk<unknown>, NdjsonError | OE, IE, OutDone, InDone, R>
}

Added in v1.0.0

duplexSchema

Signature

export declare const duplexSchema: {
  <IA, II, IR, OA, OI, OR>(
    options: Partial<NdjsonOptions> & {
      readonly inputSchema: Schema.Schema<IA, II, IR>
      readonly outputSchema: Schema.Schema<OA, OI, OR>
    }
  ): <R, InErr, OutErr, OutDone, InDone>(
    self: Channel.Channel<
      Chunk.Chunk<Uint8Array>,
      Chunk.Chunk<Uint8Array>,
      OutErr,
      NdjsonError | ParseError | InErr,
      OutDone,
      InDone,
      R
    >
  ) => Channel.Channel<
    Chunk.Chunk<OA>,
    Chunk.Chunk<IA>,
    NdjsonError | ParseError | OutErr,
    InErr,
    OutDone,
    InDone,
    R | IR | OR
  >
  <R, InErr, OutErr, OutDone, InDone, IA, II, IR, OA, OI, OR>(
    self: Channel.Channel<
      Chunk.Chunk<Uint8Array>,
      Chunk.Chunk<Uint8Array>,
      OutErr,
      NdjsonError | ParseError | InErr,
      OutDone,
      InDone,
      R
    >,
    options: Partial<NdjsonOptions> & {
      readonly inputSchema: Schema.Schema<IA, II, IR>
      readonly outputSchema: Schema.Schema<OA, OI, OR>
    }
  ): Channel.Channel<
    Chunk.Chunk<OA>,
    Chunk.Chunk<IA>,
    NdjsonError | ParseError | OutErr,
    InErr,
    OutDone,
    InDone,
    R | IR | OR
  >
}

Added in v1.0.0

duplexSchemaString

Signature

export declare const duplexSchemaString: {
  <IA, II, IR, OA, OI, OR>(
    options: Partial<NdjsonOptions> & {
      readonly inputSchema: Schema.Schema<IA, II, IR>
      readonly outputSchema: Schema.Schema<OA, OI, OR>
    }
  ): <R, InErr, OutErr, OutDone, InDone>(
    self: Channel.Channel<
      Chunk.Chunk<string>,
      Chunk.Chunk<string>,
      OutErr,
      NdjsonError | ParseError | InErr,
      OutDone,
      InDone,
      R
    >
  ) => Channel.Channel<
    Chunk.Chunk<OA>,
    Chunk.Chunk<IA>,
    NdjsonError | ParseError | OutErr,
    InErr,
    OutDone,
    InDone,
    R | IR | OR
  >
  <R, InErr, OutErr, OutDone, InDone, IA, II, IR, OA, OI, OR>(
    self: Channel.Channel<
      Chunk.Chunk<string>,
      Chunk.Chunk<string>,
      OutErr,
      NdjsonError | ParseError | InErr,
      OutDone,
      InDone,
      R
    >,
    options: Partial<NdjsonOptions> & {
      readonly inputSchema: Schema.Schema<IA, II, IR>
      readonly outputSchema: Schema.Schema<OA, OI, OR>
    }
  ): Channel.Channel<
    Chunk.Chunk<OA>,
    Chunk.Chunk<IA>,
    NdjsonError | ParseError | OutErr,
    InErr,
    OutDone,
    InDone,
    R | IR | OR
  >
}

Added in v1.0.0

duplexString

Signature

export declare const duplexString: {
  (
    options?: NdjsonOptions
  ): <R, IE, OE, OutDone, InDone>(
    self: Channel.Channel<Chunk.Chunk<string>, Chunk.Chunk<string>, OE, IE | NdjsonError, OutDone, InDone, R>
  ) => Channel.Channel<Chunk.Chunk<unknown>, Chunk.Chunk<unknown>, NdjsonError | OE, IE, OutDone, InDone, R>
  <R, IE, OE, OutDone, InDone>(
    self: Channel.Channel<Chunk.Chunk<string>, Chunk.Chunk<string>, OE, IE | NdjsonError, OutDone, InDone, R>,
    options?: NdjsonOptions
  ): Channel.Channel<Chunk.Chunk<unknown>, Chunk.Chunk<unknown>, NdjsonError | OE, IE, OutDone, InDone, R>
}

Added in v1.0.0

constructors

pack

Signature

export declare const pack: <IE = never, Done = unknown>() => Channel.Channel<
  Chunk.Chunk<Uint8Array>,
  Chunk.Chunk<unknown>,
  IE | NdjsonError,
  IE,
  Done,
  Done
>

Added in v1.0.0

packSchema

Signature

export declare const packSchema: <A, I, R>(
  schema: Schema.Schema<A, I, R>
) => <IE = never, Done = unknown>() => Channel.Channel<
  Chunk.Chunk<Uint8Array>,
  Chunk.Chunk<A>,
  IE | NdjsonError | ParseError,
  IE,
  Done,
  Done,
  R
>

Added in v1.0.0

packSchemaString

Signature

export declare const packSchemaString: <A, I, R>(
  schema: Schema.Schema<A, I, R>
) => <IE = never, Done = unknown>() => Channel.Channel<
  Chunk.Chunk<string>,
  Chunk.Chunk<A>,
  IE | NdjsonError | ParseError,
  IE,
  Done,
  Done,
  R
>

Added in v1.0.0

packString

Signature

export declare const packString: <IE = never, Done = unknown>() => Channel.Channel<
  Chunk.Chunk<string>,
  Chunk.Chunk<unknown>,
  IE | NdjsonError,
  IE,
  Done,
  Done
>

Added in v1.0.0

unpack

Signature

export declare const unpack: <IE = never, Done = unknown>(
  options?: NdjsonOptions
) => Channel.Channel<Chunk.Chunk<unknown>, Chunk.Chunk<Uint8Array>, IE | NdjsonError, IE, Done, Done>

Added in v1.0.0

unpackSchema

Signature

export declare const unpackSchema: <A, I, R>(
  schema: Schema.Schema<A, I, R>
) => <IE = never, Done = unknown>(
  options?: NdjsonOptions
) => Channel.Channel<Chunk.Chunk<A>, Chunk.Chunk<Uint8Array>, NdjsonError | ParseError | IE, IE, Done, Done, R>

Added in v1.0.0

unpackSchemaString

Signature

export declare const unpackSchemaString: <A, I, R>(
  schema: Schema.Schema<A, I, R>
) => <IE = never, Done = unknown>(
  options?: NdjsonOptions
) => Channel.Channel<Chunk.Chunk<A>, Chunk.Chunk<string>, NdjsonError | ParseError | IE, IE, Done, Done, R>

Added in v1.0.0

unpackString

Signature

export declare const unpackString: <IE = never, Done = unknown>(
  options?: NdjsonOptions
) => Channel.Channel<Chunk.Chunk<unknown>, Chunk.Chunk<string>, IE | NdjsonError, IE, Done, Done>

Added in v1.0.0

errors

NdjsonError (class)

Signature

export declare class NdjsonError

Added in v1.0.0

models

NdjsonOptions (interface)

Represents a set of options which can be used to control how the newline delimited JSON is handled.

Signature

export interface NdjsonOptions {
  /**
   * Whether or not the newline delimited JSON parser should ignore empty lines.
   *
   * Defaults to `false`.
   *
   * From the [newline delimited JSON spec](https://github.com/ndjson/ndjson-spec):
   * ```text
   * The parser MAY silently ignore empty lines, e.g. \n\n. This behavior MUST
   * be documented and SHOULD be configurable by the user of the parser.
   * ```
   *
   * @since 1.0.0
   */
  readonly ignoreEmptyLines?: boolean
}

Added in v1.0.0

type ids

NdjsonErrorTypeId

Signature

export declare const NdjsonErrorTypeId: typeof NdjsonErrorTypeId

Added in v1.0.0

NdjsonErrorTypeId (type alias)

Signature

export type NdjsonErrorTypeId = typeof NdjsonErrorTypeId

Added in v1.0.0