Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BytesImpl

Implementation of the Bytes interface

Hierarchy

Implements

Index

Constructors

constructor

  • new BytesImpl(buffer: Uint8Array, offset?: number, length?: number): BytesImpl
  • Create a new BytesImpl instance

    Parameters

    • buffer: Uint8Array

      the internal buffer

    • Default value offset: number = 0

      the offset of the slice

    • Default value length: number = buffer.length

      the number of bytes in the slice

    Returns BytesImpl

Properties

$buffer

$buffer: Uint8Array

The internal buffer

$length

$length: number

The number of bytes in the slice

$offset

$offset: number

The offset of the slice

Methods

asArray

  • asArray(): Uint8Array
  • Get a copy of the array containing this value.

    Returns Uint8Array

    This value in binary form

asBuffer

  • asBuffer(): Buffer
  • Get a copy of the buffer containing this value.

    deprecated

    since version 6.11. Buffer has been replaced by Uint8Array. This will be removed in a future release.

    Returns Buffer

    This value in binary form

copyTo

  • copyTo(target: Uint8Array, offset?: number): void
  • inheritdoc

    Parameters

    • target: Uint8Array
    • Default value offset: number = 0

    Returns void

equalBytes

  • equalBytes(buffer: Uint8Array, offset?: number, length?: number): boolean
  • Check if the Bytes are equal to a buffer slices

    Parameters

    • buffer: Uint8Array

      the buffer

    • Default value offset: number = 0

      the offset of the slice

    • Default value length: number = buffer.length

      the number of bytes in the slice

    Returns boolean

    true if the two bytes are equal

equals

  • Check if the Bytes are equal to a buffer slices

    Parameters

    Returns boolean

    true if the two bytes are equal

length

  • length(): number
  • Get the number of bytes

    Returns number

    The length of the data in bytes

Static toString

  • toString(): string
  • Returns string

Copyright © 2025 DiffusionData Ltd. All Rights Reserved.