Create a new Binary instance.
Optional
buffer: BinarySequencea buffer object containing the binary data.
Optional
subType: numberthe option binary type.
The bytes of the Binary value.
The format of a Binary value in BSON is defined as:
binary ::= int32 subtype (byte*)
This buffer
is the "(byte*)" segment.
Unless the value is subtype 2, then deserialize will read the first 4 bytes as an int32 and set this to the remaining bytes.
binary ::= int32 unsigned_byte(2) int32 (byte*)
The Binary's buffer
can be larger than the Binary's content.
This property is used to determine where the content ends in the buffer.
The binary subtype.
Current defined values are:
unsigned_byte(0)
Generic binary subtypeunsigned_byte(1)
Functionunsigned_byte(2)
Binary (Deprecated)unsigned_byte(3)
UUID (Deprecated)unsigned_byte(4)
UUIDunsigned_byte(5)
MD5unsigned_byte(6)
Encrypted BSON valueunsigned_byte(7)
Compressed BSON columnunsigned_byte(8)
Sensitiveunsigned_byte(9)
Vectorunsigned_byte(128)
- unsigned_byte(255)
User definedStatic
Readonly
BUFFER_Initial buffer default size
Static
Readonly
SUBTYPE_Byte Array BSON type
Static
Readonly
SUBTYPE_Column BSON type
Static
Readonly
SUBTYPE_Default BSON type
Static
Readonly
SUBTYPE_Encrypted BSON type
Static
Readonly
SUBTYPE_Function BSON type
Static
Readonly
SUBTYPE_MD5 BSON type
Static
Readonly
SUBTYPE_Sensitive BSON type
Static
Readonly
SUBTYPE_User BSON type
Static
Readonly
SUBTYPE_UUID BSON type
Static
Readonly
SUBTYPE_Deprecated UUID BSON type
Static
Readonly
SUBTYPE_Vector BSON type
Static
Readonly
VECTOR_datatype of a Binary Vector (subtype: 9)
If this Binary represents a Packed bit Vector (binary.buffer[0] === Binary.VECTOR_TYPE.PackedBit
),
returns a copy of the bit unpacked into a new Int8Array.
Use toPackedBits
to get the bits still in packed form.
If the Binary is not a Vector, or the datatype is not PackedBit, an error is thrown.
If this Binary represents packed bit Vector (binary.buffer[0] === Binary.VECTOR_TYPE.PackedBit
),
returns a copy of the bytes that are packed bits.
Use toBits
to get the unpacked bits.
If the Binary is not a Vector, or the datatype is not PackedBit, an error is thrown.
Writes a buffer to the binary.
a string or buffer to be written to the Binary BSON object.
specify the binary of where to write the content.
Static
createStatic
createStatic
fromStatic
fromStatic
fromStatic
from
A class representation of the BSON Binary type.