Create a new Binary instance.
Optionalbuffer: BinarySequencea buffer object containing the binary data.
OptionalsubType: 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 ReadonlyBUFFER_Initial buffer default size
Static ReadonlySUBTYPE_Byte Array BSON type
Static ReadonlySUBTYPE_Column BSON type
Static ReadonlySUBTYPE_Default BSON type
Static ReadonlySUBTYPE_Encrypted BSON type
Static ReadonlySUBTYPE_Function BSON type
Static ReadonlySUBTYPE_MD5 BSON type
Static ReadonlySUBTYPE_Sensitive BSON type
Static ReadonlySUBTYPE_User BSON type
Static ReadonlySUBTYPE_UUID BSON type
Static ReadonlySUBTYPE_Deprecated UUID BSON type
Static ReadonlySUBTYPE_Vector BSON type
Static ReadonlyVECTOR_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 a Float32 Vector (binary.buffer[0] === Binary.VECTOR_TYPE.Float32),
returns a copy of the bytes in a new Float32Array.
If the Binary is not a Vector, or the datatype is not Float32, 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.
StaticcreateStaticcreateStaticfromStaticfromStaticfromStaticfrom
A class representation of the BSON Binary type.