Skip to main content
Latest
class Bson.Binary
import { Bson } from "https://deno.land/x/exodus@0.1.8/deps.ts";
const { Binary } = Bson;

A class representation of the BSON Binary type.

Constructors

new
Binary(buffer?: string | BinarySequence, subType?: number)

Properties

_bsontype: "Binary"
buffer: Buffer
position: number
sub_type: number

Methods

length(): number

the length of the binary sequence

put(byteValue:
| string
| number
| Uint8Array
| Buffer
| number[]
): void

Updates this binary with byte_value.

read(position: number, length: number): BinarySequence

Reads length bytes starting at position.

value(asRaw?: boolean): string | BinarySequence

Returns the value of this binary as a string.

write(sequence: string | BinarySequence, offset: number): void

Writes a buffer or string to the binary.

Static Properties

readonly
BUFFER_SIZE: number

Initial buffer default size

readonly
SUBTYPE_BYTE_ARRAY: number

Byte Array BSON type

readonly
SUBTYPE_DEFAULT: number

Default BSON type

readonly
SUBTYPE_FUNCTION: number

Function BSON type

readonly
SUBTYPE_MD5: number

MD5 BSON type

readonly
SUBTYPE_USER_DEFINED: number

User BSON type

readonly
SUBTYPE_UUID: number

UUID BSON type

readonly
SUBTYPE_UUID_OLD: number

Deprecated UUID BSON type @deprecated Please use SUBTYPE_UUID