dataview-stream - v2.0.2
    Preparing search index...

    Class DataViewWritableStream

    This is readable in the DataView sense, but writable in the stream sense.

    Hierarchy

    • WritableStream<Uint8Array>
      • DataViewWritableStream
    Index

    Constructors

    Properties

    SIZE: typeof SIZE = SIZE
    locked: boolean

    The locked read-only property of the WritableStream interface returns a boolean indicating whether the WritableStream is locked to a writer.

    MDN Reference

    Accessors

    • get littleEndian(): boolean

      Current default endianness. May be changed in the middle of the stream for formats like pcapng.

      Returns boolean

    • set littleEndian(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get offset(): number

      Current read position in bytes from the original start of the stream.

      Returns number

    Methods

    • The abort() method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.

      MDN Reference

      Parameters

      • Optionalreason: any

      Returns Promise<void>

    • Wait for an ASCII string of a given size (in bytes) to be available in the stream. Decoding turns each byte into a single JS character directly, which may not be exactly what you want for characters over 127.

      Parameters

      • length: number

        Number of bytes to read.

      Returns Promise<string>

      Promise that is rejected if stream is closed without enough data.

    • Fully read a number of bytes from the stream.

      Parameters

      • size: number

        Number of bytes.

      Returns Promise<Uint8Array<ArrayBufferLike>>

      Promise that is rejected if stream is closed without enough data.

    • The close() method of the WritableStream interface closes the associated stream.

      MDN Reference

      Returns Promise<void>

    • Wait for a short float to be available in the stream.

      Parameters

      • littleEndian: boolean = ...

        Override th endianness of the stream for a single read.

      Returns Promise<number>

      Promise that is rejected if stream is closed without enough data.

    • Wait for a float to be available in the stream.

      Parameters

      • littleEndian: boolean = ...

        Override th endianness of the stream for a single read.

      Returns Promise<number>

      Promise that is rejected if stream is closed without enough data.

    • Wait for a double to be available in the stream.

      Parameters

      • littleEndian: boolean = ...

        Override th endianness of the stream for a single read.

      Returns Promise<number>

      Promise that is rejected if stream is closed without enough data.

    • The getWriter() method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance.

      MDN Reference

      Returns WritableStreamDefaultWriter<Uint8Array<ArrayBufferLike>>

    • Wait for an signed short integer to be available in the stream.

      Parameters

      • littleEndian: boolean = ...

        Override th endianness of the stream for a single read.

      Returns Promise<number>

      Promise that is rejected if stream is closed without enough data.

    • Wait for an signed integer to be available in the stream.

      Parameters

      • littleEndian: boolean = ...

        Override th endianness of the stream for a single read.

      Returns Promise<number>

      Promise that is rejected if stream is closed without enough data.

    • Wait for an signed long integer to be available in the stream.

      Parameters

      • littleEndian: boolean = ...

        Override th endianness of the stream for a single read.

      Returns Promise<bigint>

      Promise that is rejected if stream is closed without enough data.

    • Wait for an signed byte to be available in the stream.

      Returns Promise<number>

      Promise that is rejected if stream is closed without enough data.

    • Peek at some bytes at the front of the queue. This will cut the buffers in the queue up, so it's likely to be slightly less performant than reading chunks of the correct size, unless you're going to read this exact size again next.

      Parameters

      • size: number

        Number of bytes to peek at.

      Returns Promise<Uint8Array<ArrayBufferLike>>

      Promise fulfilled with array of the expected size.

    • Wait for an entire packet structure at once. Only useful for relatively- simplistic structures. If all of the fields have known size, the length is not required.

      Type Parameters

      Parameters

      • description: T

        Field descriptions, in the order you want them read.

      • Optionallength: number

        Number of bytes, if needed.

      Returns Promise<
          {
              [K in string
              | number
              | symbol]: {
                  [K in string | number | symbol as K extends `_${string}` ? never : K]: ReaderType<
                      T[K],
                  >
              }[K]
          },
      >

      This, for chaining.

    • Wait for an unsigned short integer to be available in the stream.

      Parameters

      • littleEndian: boolean = ...

        Override th endianness of the stream for a single read.

      Returns Promise<number>

      Promise that is rejected if stream is closed without enough data.

    • Wait for an unsigned integer to be available in the stream.

      Parameters

      • littleEndian: boolean = ...

        Override th endianness of the stream for a single read.

      Returns Promise<number>

      Promise that is rejected if stream is closed without enough data.

    • Wait for an unsigned long integer to be available in the stream.

      Parameters

      • littleEndian: boolean = ...

        Override th endianness of the stream for a single read.

      Returns Promise<bigint>

      Promise that is rejected if stream is closed without enough data.

    • Wait for an unsigned byte to be available in the stream.

      Returns Promise<number>

      Promise that is rejected if stream is closed without enough data.

    • Wait for a UTF8-encoded string of a given size (in bytes) to be available in the stream.

      Parameters

      • length: number

        Number of bytes to read.

      Returns Promise<string>

      Promise that is rejected if stream is closed without enough data.

    • Wait for a number of bytes to be available to read immediately from the stream.

      Parameters

      • size: number

        Number of bytes.

      Returns Promise<void>

      Promise that is rejected if stream is closed without enough data.