new Binary(buffer, subType){Binary}
A class representation of the BSON Binary type.
Sub types
- BSON.BSON_BINARY_SUBTYPE_DEFAULT, default BSON type.
- BSON.BSON_BINARY_SUBTYPE_FUNCTION, BSON function type.
- BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY, BSON byte array type.
- BSON.BSON_BINARY_SUBTYPE_UUID, BSON uuid type.
- BSON.BSON_BINARY_SUBTYPE_MD5, BSON md5 type.
- BSON.BSON_BINARY_SUBTYPE_USER_DEFINED, BSON user defined type.
| Name | Type | Description | 
|---|---|---|
| buffer | Buffer | a buffer object containing the binary data. | 
| subType | Number | optional the option binary type. | 
Members
- 
    staticBinary.SUBTYPE_BYTE_ARRAY
- 
    
    Byte Array BSON type 
- 
    staticBinary.SUBTYPE_DEFAULT
- 
    
    Default BSON type 
- 
    staticBinary.SUBTYPE_FUNCTION
- 
    
    Function BSON type 
- 
    staticBinary.SUBTYPE_MD5
- 
    
    MD5 BSON type 
- 
    staticBinary.SUBTYPE_USER_DEFINED
- 
    
    User BSON type 
- 
    staticBinary.SUBTYPE_UUID
- 
    
    UUID BSON type 
- 
    staticBinary.SUBTYPE_UUID_OLD
- 
    
    OLD UUID BSON type 
Methods
- 
    length(){number}
- 
    
    
    Length. Returns:length of the binary.
 
- 
    put(byte_value)
- 
    
    
    Updates this binary with byte_value. Name Type Description byte_valuestring a single byte we wish to write. 
- 
    read(position, length){Buffer}
- 
    
    
    Reads length bytes starting at position. Name Type Description positionnumber read from the given position in the Binary. lengthnumber the number of bytes to read. 
- 
    value(){string}
- 
    
    
    Returns the value of this binary as a string. 
- 
    write(string, offset){null}
- 
    
    
    Writes a buffer or string to the binary. Name Type Description stringBuffer | string a string or buffer to be written to the Binary BSON object. offsetnumber specify the binary of where to write the content.