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

    Class DataViewReadableStream

    Write bytes to a growing buffer. Intended for relatively-small final buffer sizes; everything is held in memory.

    Hierarchy

    • ReadableStream<Uint8Array>
      • DataViewReadableStream
    Index

    Properties

    locked: boolean

    The locked read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.

    MDN Reference

    Accessors

    Methods

    • Parameters

      • Optionaloptions: ReadableStreamIteratorOptions

      Returns ReadableStreamAsyncIterator<Uint8Array<ArrayBufferLike>>

    • When outputting with console.log('%O', this) or at the node REPL, see the current chunk structure.

      Parameters

      • depth: number

        Current depth.

      • options: InspectOptions

        Options for writing, generated by util.inpect.

      Returns string

      Formatted string.

    • Convert a string to ASCII bytes.

      Parameters

      • s: string

        Latin-1 string.

      Returns this

      This, for chaining.

      Character not in 0-256.

    • Write an arbitrarily-large amount of data to the writer. If this buffer is larger than chunkSize, it is appended directly -- see the copyBuffers option for what should happen in this case. If the buffer is less than the chunkSize + 8 bytes, the buffer is always copied, since it might be worth writing some more data into that same chunk later.

      Parameters

      • buf: Uint8Array

        Bytes to write.

      • copy: boolean = ...

        Override the copyBuffers option if specified.

      Returns this

      This, for chaining.

    • The cancel() method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.

      MDN Reference

      Parameters

      • Optionalreason: any

      Returns Promise<void>

    • No more data will be written. Flush everything that is pending.

      Returns this

      This, for chaining.

    • Write a two-byte float.

      Parameters

      • n: number

        Number that fits in a short float without losing precision.

      • littleEndian: boolean = ...

        Override stream's littleEndian option.

      Returns this

      This, for chaining.

      If number would lose precision on write.

    • Write a four-byte float.

      Parameters

      • n: number

        Number that fits in a float.

      • littleEndian: boolean = ...

        Override stream's littleEndian option.

      Returns this

      This, for chaining.

      Would lose precision.

    • Write an eight-byte integer.

      Parameters

      • n: number

        Double.

      • littleEndian: boolean = ...

        Override stream's littleEndian option.

      Returns this

      This, for chaining.

    • Usually, chunks will be only become available to be read after chunkSize bytes have been written. Flush forces whatever is currently queued into the readable stream.

      Returns this

      This, for chaining.

    • The getReader() method of the ReadableStream interface creates a reader and locks the stream to it.

      MDN Reference

      Parameters

      • options: { mode: "byob" }

      Returns ReadableStreamBYOBReader

    • Returns ReadableStreamDefaultReader<Uint8Array<ArrayBufferLike>>

    • Parameters

      • Optionaloptions: ReadableStreamGetReaderOptions

      Returns ReadableStreamReader<Uint8Array<ArrayBufferLike>>

    • Write a signed two-byte integer.

      Parameters

      • n: number

        Signed short int.

      • littleEndian: boolean = ...

        Override stream's littleEndian option.

      Returns this

      This, for chaining.

    • Write a signed four-byte integer.

      Parameters

      • n: number

        Signed int.

      • littleEndian: boolean = ...

        Override stream's littleEndian option.

      Returns this

      This, for chaining.

    • Write an eight-byte signed integer.

      Parameters

      • n: number | bigint

        Signed long long.

      • littleEndian: boolean = ...

        Override stream's littleEndian option.

      Returns this

      This, for chaining.

    • Write a signed byte.

      Parameters

      • n: number

        Signed byte.

      Returns this

      This, for chaining.

    • The pipeThrough() method of the ReadableStream interface provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair.

      MDN Reference

      Type Parameters

      • T

      Parameters

      • transform: ReadableWritablePair<T, Uint8Array<ArrayBufferLike>>
      • Optionaloptions: StreamPipeOptions

      Returns ReadableStream<T>

    • The pipeTo() method of the ReadableStream interface pipes the current ReadableStream to a given WritableStream and returns a Promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.

      MDN Reference

      Parameters

      • destination: WritableStream<Uint8Array<ArrayBufferLike>>
      • Optionaloptions: StreamPipeOptions

      Returns Promise<void>

    • Destructively read all bytes from the reader as a single buffer.

      Returns Promise<Uint8Array<ArrayBufferLike>>

      Bytes.

    • The tee() method of the two-element array containing the two resulting branches as new ReadableStream instances.

      MDN Reference

      Returns [
          ReadableStream<Uint8Array<ArrayBufferLike>>,
          ReadableStream<Uint8Array<ArrayBufferLike>>,
      ]

    • Write a two-byte unsigned integer.

      Parameters

      • n: number

        Unsigned short int.

      • littleEndian: boolean = ...

        Override stream's littleEndian option.

      Returns this

      This, for chaining.

    • Write a four-byte unsigned integer.

      Parameters

      • n: number

        Unsigned int.

      • littleEndian: boolean = ...

        Override stream's littleEndian option.

      Returns this

      This, for chaining.

    • Write an eight-byte unsigned integer.

      Parameters

      • n: number | bigint

        Unsigned long long.

      • littleEndian: boolean = ...

        Override stream's littleEndian option.

      Returns this

      This, for chaining.

    • Write a single unsigned byte.

      Parameters

      • n: number

        Byte.

      Returns this

      This, for chaining.

    • Encode the string as UTF8.

      Parameters

      • s: string

        String. If there are unpaired surrogates, they will be switched to the replacement character.

      Returns this

      This, for chaining.

    • Parameters

      • Optionaloptions: ReadableStreamIteratorOptions

      Returns ReadableStreamAsyncIterator<Uint8Array<ArrayBufferLike>>