@gibme/bytepack
    Preparing search index...

    Class Writer

    Hierarchy

    • Readable
      • Writer
    Index

    Constructors

    • Creates a new instance of the writer with the buffer preloaded with data if specified

      Parameters

      • payload: string | Uint8Array<ArrayBufferLike> | Buffer<ArrayBufferLike> | Writer | Reader = ...
      • encoding: BufferEncoding = 'hex'

      Returns Writer

    Accessors

    • get buffer(): Buffer

      Returns the current contents of the buffer

      Returns Buffer

    • get length(): number

      Returns the byte size of the current buffer

      Returns number

    Methods

    • Writes the supplied value to the buffer

      Parameters

      • payload: string | Uint8Array<ArrayBufferLike> | Buffer<ArrayBufferLike> | Writer | Reader
      • encoding: BufferEncoding = 'hex'

      Returns Writer

    • Writes the specified bytes to the buffer

      Parameters

      • value: Uint8Array<ArrayBufferLike> | Buffer<ArrayBufferLike>

      Returns Writer

    • Clears the current write buffer

      Returns void

    • Writes a hash to the buffer

      Parameters

      • hash: string | Uint8Array<ArrayBufferLike> | Buffer<ArrayBufferLike>
      • encoding: BufferEncoding = 'hex'

      Returns Writer

    • Writes the hex encoded value to the buffer

      Parameters

      • hex: string | Uint8Array<ArrayBufferLike> | Buffer<ArrayBufferLike>

      Returns Writer

    • Writes an int16_t to the buffer

      Parameters

      • value: number | BigInteger

      Returns Writer

    • Writes an int32_t to the buffer

      Parameters

      • value: number | BigInteger

      Returns Writer

    • Writes an int64_t to the buffer

      Parameters

      • value: number | BigInteger

      Returns Writer

    • Writes an int8_t to the buffer

      Parameters

      • value: number | BigInteger

      Returns Writer

    • Writes a signed integer to the buffer

      Parameters

      • value: number | BigInteger
      • bits: number = ...
      • bigEndian: boolean = false

      Returns Writer

    • Writes a string to the buffer

      Parameters

      • value: string
      • encoding: BufferEncoding = 'utf-8'

      Returns Writer

    • Writes a time_t to the buffer

      Parameters

      • value: Date
      • bigEndian: boolean = false

      Returns Writer

    • Dumps the buffer to a string

      Parameters

      • encoding: BufferEncoding = 'hex'

      Returns string

    • Writes an uint128_t to the buffer

      Parameters

      • value: number | BigInteger
      • bigEndian: boolean = false

      Returns Writer

    • Writes an uint16_t to the buffer

      Parameters

      • value: number | BigInteger
      • bigEndian: boolean = false

      Returns Writer

    • Writes an uint256_t to the buffer

      Parameters

      • value: number | BigInteger
      • bigEndian: boolean = false

      Returns Writer

    • Writes an uint32_t to the buffer

      Parameters

      • value: number | BigInteger
      • bigEndian: boolean = false

      Returns Writer

    • Writes an uint512_t to the buffer

      Parameters

      • value: number | BigInteger
      • bigEndian: boolean = false

      Returns Writer

    • Writes an uint64_t to the buffer

      Parameters

      • value: number | BigInteger
      • bigEndian: boolean = false

      Returns Writer

    • Writes an uint8_t to the buffer

      Parameters

      • value: number | BigInteger
      • bigEndian: boolean = false

      Returns Writer

    • Writes an unsigned integer to the buffer

      Parameters

      • value: number | BigInteger
      • bits: number = ...
      • bigEndian: boolean = false

      Returns Writer

    • Writes a Varint to the buffer

      Parameters

      • value: number | BigInteger
      • levin: boolean = false

      Returns Writer