json-stream-lite - v1.2.2
    Preparing search index...

    Class JsonBoolean<T>

    Represents a JSON boolean value (true or false).

    Type Parameters

    • T extends boolean = boolean

      The specific boolean type (defaults to boolean)

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    buffer: ByteBuffer
    consumed: boolean = false

    Accessors

    • set allowBufferToBeExceeded(value: boolean): void

      Sets whether to allow exceeding the buffer size temporarily. Default is true.

      Parameters

      • value: boolean

        True to allow exceeding the buffer size, false to enforce the limit

      Returns void

    • set maxBufferSize(size: number): void

      Sets the maximum buffer size before compaction occurs. Defaults to 100 KB. NOTE: The buffer size may be exceeded temporarily during reads. For example, if a large string is read that exceeds the max size. If this is not desired, set allowBufferToBeExceeded to false (default is true).

      Parameters

      • size: number

        The maximum buffer size in bytes

      Returns void

    Methods

    • Attempts to parse by executing a callback, reverting buffer state on failure.

      Type Parameters

      Parameters

      • cb: (entity: this) => T

        The callback function to execute

      Returns T | undefined

      The result of the callback, or undefined if parsing needs more data

      Error if the entity has already been consumed

    • Asynchronously serializes a value into a JSON string using json-stream-lite. See jsonStreamStringifyAsync for more details.

      Parameters

      • value: AsyncIterable<unknown, any, any> | Iterable<unknown, any, any>
      • Optionalreplacer: any
      • indent: number = 0
      • Optionaloptions: JsonStreamStringifyOptions

      Returns AsyncGenerator<string>

      An async generator yielding JSON string chunks

    • Asynchronously serializes a value into JSON as Uint8Array byte chunks using json-stream-lite. See jsonStreamStringifyBytesAsync for more details.

      Parameters

      • value: AsyncIterable<unknown, any, any> | Iterable<unknown, any, any>
      • Optionalreplacer: any
      • indent: number = 0
      • Optionaloptions: JsonStreamStringifyOptions

      Returns AsyncGenerator<Uint8Array<ArrayBufferLike>>

      An async generator yielding JSON byte chunks