Class Binary

A class representation of the BSON Binary type.

Hierarchy (view full)

Constructors

  • Create a new Binary instance.

    Parameters

    • Optionalbuffer: BinarySequence

      a buffer object containing the binary data.

    • OptionalsubType: number

      the option binary type.

    Returns Binary

Properties

buffer: Uint8Array
position: number
sub_type: number
BUFFER_SIZE: 256 = 256

Initial buffer default size

SUBTYPE_BYTE_ARRAY: 2 = 2

Byte Array BSON type

SUBTYPE_COLUMN: 7 = 7

Column BSON type

SUBTYPE_DEFAULT: 0 = 0

Default BSON type

SUBTYPE_ENCRYPTED: 6 = 6

Encrypted BSON type

SUBTYPE_FUNCTION: 1 = 1

Function BSON type

SUBTYPE_MD5: 5 = 5

MD5 BSON type

SUBTYPE_SENSITIVE: 8 = 8

Sensitive BSON type

SUBTYPE_USER_DEFINED: 128 = 128

User BSON type

SUBTYPE_UUID: 4 = 4

UUID BSON type

SUBTYPE_UUID_OLD: 3 = 3

Deprecated UUID BSON type

Please use SUBTYPE_UUID

Accessors

  • get _bsontype(): "Binary"
  • Returns "Binary"

Methods

  • Prints a human-readable string of BSON value information If invoked manually without node.js.inspect function, this will default to a modified JSON.stringify

    Parameters

    • Optionaldepth: number
    • Optionaloptions: unknown
    • Optionalinspect: InspectFn

    Returns string

  • the length of the binary sequence

    Returns number

  • Updates this binary with byte_value.

    Parameters

    • byteValue:
          | string
          | number
          | Uint8Array
          | number[]

      a single byte we wish to write.

    Returns void

  • Reads length bytes starting at position.

    Parameters

    • position: number

      read from the given position in the Binary.

    • length: number

      the number of bytes to read.

    Returns BinarySequence

  • Returns string

  • Returns a string representation of an object.

    Parameters

    • Optionalencoding:
          | "utf8"
          | "utf-8"
          | "base64"
          | "hex"

    Returns string

  • Returns UUID

  • returns a view of the binary value as a Uint8Array

    Returns Uint8Array

  • Writes a buffer to the binary.

    Parameters

    • sequence: BinarySequence

      a string or buffer to be written to the Binary BSON object.

    • offset: number

      specify the binary of where to write the content.

    Returns void

  • Creates an Binary instance from a base64 string

    Parameters

    • base64: string
    • OptionalsubType: number

    Returns Binary

  • Creates an Binary instance from a hex digit string

    Parameters

    • hex: string
    • OptionalsubType: number

    Returns Binary