@holzchopf/array-buffer-stream
v1.0.1
Published
Make an ArrayBuffer readable/writable like a stream.
Downloads
1
Readme
This file was auto-generated with zdoccer.js
2.0.3
Index
- @holzchopf/array-buffer-stream
class ArrayBufferStream
buffer: ArrayBuffer
cursor = 0
constructor(buffer: ArrayBuffer)
eof(): boolean
append(buffer: ArrayBuffer)
readBytes(byteLength: number): ArrayBuffer
readUint8()
readUint16(littleEndian?: boolean | undefined)
readUint32(littleEndian?: boolean | undefined)
readBigUint64(littleEndian?: boolean | undefined)
readUleb128()
readInt8()
readInt16(littleEndian?: boolean | undefined)
readInt32(littleEndian?: boolean | undefined)
readBigInt64(littleEndian?: boolean | undefined)
readLeb128()
readFloat32(littleEndian?: boolean | undefined)
readFloat64(littleEndian?: boolean | undefined)
readAsciiString(byteLength: number)
readUtf8String(byteLength: number)
readUtf16String(byteLength: number, littleEndian?: boolean | undefined)
writeBytes(bytes: ArrayBuffer)
writeUint8(value: number)
writeUint16(value: number, littleEndian?: boolean | undefined)
writeUint32(value: number, littleEndian?: boolean | undefined)
writeBigUint64(value: bigint, littleEndian?: boolean | undefined)
writeUleb128(value: number)
writeInt8(value: number)
writeInt16(value: number, littleEndian?: boolean | undefined)
writeInt32(value: number, littleEndian?: boolean | undefined)
writeBigInt64(value: bigint, littleEndian?: boolean | undefined)
writeLeb128(value: number)
writeFloat32(value: number, littleEndian?: boolean | undefined)
writeFloat64(value: number, littleEndian?: boolean | undefined)
writeAsciiString(string: string)
writeUtf8String(string: string)
writeUtf16String(string: string, littleEndian?: boolean | undefined)
function joinArrayBuffers(buffers: ArrayBuffer[]): ArrayBuffer
original Markdown from src/_preamble.md
@holzchopf/array-buffer-stream
Provides a wrapper class that lets you access an ArrayBuffer like a stream, i.e. every read/write operation will move the cursor by the number of bytes read/written.
transformed Javadoc from src/array-buffer-stream.ts
class ArrayBufferStream
Main ArrayBufferStream class.
buffer: ArrayBuffer
Underlying ArrayBuffer.
cursor = 0
Read/write position.
constructor(buffer: ArrayBuffer)
Creates an ArrayBufferStream from an existing ArrayBuffer.
eof(): boolean
Returns whether the end of the stream is reached.
append(buffer: ArrayBuffer)
Creates a new ArrayBuffer from this stream's buffer and the given one and sets it as this stream's buffer.
- param
buffer
— ArrayBuffer to append.
readBytes(byteLength: number): ArrayBuffer
Reads a number of bytes and returns them as ArrayBuffer copy.
- param
byteLength
— Bytes to read.
readUint8()
Reads the next byte as unsigned 8 bit integer and returns it as number.
readUint16(littleEndian?: boolean | undefined)
Reads the next bytes as unsigned 16 bit integer and returns it as number.
- param
littleEndian
— If true, a little-endian value should be read.
readUint32(littleEndian?: boolean | undefined)
Reads the next bytes as unsigned 32 bit integer and returns it as number.
- param
littleEndian
— If true, a little-endian value should be read.
readBigUint64(littleEndian?: boolean | undefined)
Reads the next bytes as unsigned 64 bit integer and returns it as bigint.
- param
littleEndian
— If true, a little-endian value should be read.
readUleb128()
Reads the next bytes as unsigned LEB128 value and returns it as number.
readInt8()
Reads the next byte as signed 8 bit integer and returns it as number.
readInt16(littleEndian?: boolean | undefined)
Reads the next bytes as signed 16 bit integer and returns it as number.
- param
littleEndian
— If true, a little-endian value should be read.
readInt32(littleEndian?: boolean | undefined)
Reads the next bytes as signed 32 bit integer and returns it as number.
- param
littleEndian
— If true, a little-endian value should be read.
readBigInt64(littleEndian?: boolean | undefined)
Reads the next bytes as signed 64 bit integer and returns it as bigint.
- param
littleEndian
— If true, a little-endian value should be read.
readLeb128()
Reads the next bytes as signed LEB128 value and returns it as number.
readFloat32(littleEndian?: boolean | undefined)
Reads the next bytes as 32 bit float and returns it as number.
- param
littleEndian
— If true, a little-endian value should be read.
readFloat64(littleEndian?: boolean | undefined)
Reads the next bytes as 64 bit float and returns it as number.
- param
littleEndian
— If true, a little-endian value should be read.
readAsciiString(byteLength: number)
Reads a number of bytes as ASCII string and returns it as string.
- param
byteLength
— Bytes to read.
readUtf8String(byteLength: number)
Reads a number of bytes as UTF8 string and returns it as string.
- param
byteLength
— Bytes to read.
readUtf16String(byteLength: number, littleEndian?: boolean | undefined)
Reads a number of bytes as UTF16 string and returns it as string.
- param
byteLength
— Bytes to read. - param
littleEndian
— If true, a little-endian value should be read.
writeBytes(bytes: ArrayBuffer)
Writes multiple bytes.
- param
bytes
— Bytes to write.
writeUint8(value: number)
Writes an unsigned 8 bit integer.
- param
value
— The value to write.
writeUint16(value: number, littleEndian?: boolean | undefined)
Writes an unsigned 16 bit integer.
- param
value
— The value to write. - param
littleEndian
— If true, a little-endian value should be written.
writeUint32(value: number, littleEndian?: boolean | undefined)
Writes an unsigned 32 bit integer.
- param
value
— The value to write. - param
littleEndian
— If true, a little-endian value should be written.
writeBigUint64(value: bigint, littleEndian?: boolean | undefined)
Writes an unsigned 64 bit big integer.
- param
value
— The value to write. - param
littleEndian
— If true, a little-endian value should be written.
writeUleb128(value: number)
Writes an unsigned LEB128 value.
- param
value
— The value to write.
writeInt8(value: number)
Writes a signed 8 bit integer.
- param
value
— The value to write.
writeInt16(value: number, littleEndian?: boolean | undefined)
Writes a signed 16 bit integer.
- param
value
— The value to write. - param
littleEndian
— If true, a little-endian value should be written.
writeInt32(value: number, littleEndian?: boolean | undefined)
Writes a signed 32 bit integer.
- param
value
— The value to write. - param
littleEndian
— If true, a little-endian value should be written.
writeBigInt64(value: bigint, littleEndian?: boolean | undefined)
Writes a signed 64 bit big integer.
- param
value
— The value to write. - param
littleEndian
— If true, a little-endian value should be written.
writeLeb128(value: number)
Writes a signed LEB128 value.
- param
value
— The value to write.
writeFloat32(value: number, littleEndian?: boolean | undefined)
Writes a 32 bit float.
- param
value
— The value to write. - param
littleEndian
— If true, a little-endian value should be written.
writeFloat64(value: number, littleEndian?: boolean | undefined)
Writes a 64 bit float.
- param
value
— The value to write. - param
littleEndian
— If true, a little-endian value should be written.
writeAsciiString(string: string)
Writes a string as ASCII string.
- param
string
— String to write.
writeUtf8String(string: string)
Writes a string as UTF-8 string.
- param
string
— String to write.
writeUtf16String(string: string, littleEndian?: boolean | undefined)
Writes a string as UTF-16 string.
- param
string
— String to write.
transformed Javadoc from src/join-array-buffers.ts
function joinArrayBuffers(buffers: ArrayBuffer[]): ArrayBuffer
Creates and returns a new ArrayBuffer by concatenating all of the buffers provided.
- param
buffers
— ArrayBuffers to join.