API 参考
    正在准备搜索索引...

    A class representation of the BSON Binary type.

    层级 (查看层级一览)

    索引

    构造函数

    • Create a new Binary instance.

      This constructor can accept a string as its first argument. In this case, this string will be encoded using ISO-8859-1, not using UTF-8. This is almost certainly not what you want. Use new Binary(Buffer.from(string)) instead to convert the string to a Buffer using UTF-8 first.

      参数

      • 可选buffer: string | BinarySequence

        a buffer object containing the binary data.

      • 可选subType: number

        the option binary type.

      返回 Binary

    属性

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

    Initial buffer default size

    SUBTYPE_BYTE_ARRAY: 2

    Byte Array BSON type

    SUBTYPE_COLUMN: 7

    Column BSON type

    SUBTYPE_DEFAULT: 0

    Default BSON type

    SUBTYPE_ENCRYPTED: 6

    Encrypted BSON type

    SUBTYPE_FUNCTION: 1

    Function BSON type

    SUBTYPE_MD5: 5

    MD5 BSON type

    SUBTYPE_USER_DEFINED: 128

    User BSON type

    SUBTYPE_UUID: 4

    UUID BSON type

    SUBTYPE_UUID_OLD: 3

    Deprecated UUID BSON type

    Please use SUBTYPE_UUID

    访问器

    • get _bsontype(): "Binary"

      返回 "Binary"

    方法

    • 返回 string

    • the length of the binary sequence

      返回 number

    • Updates this binary with byte_value.

      参数

      • byteValue: string | number | number[] | Uint8Array<ArrayBufferLike>

        a single byte we wish to write.

      返回 void

    • Reads length bytes starting at position.

      参数

      • position: number

        read from the given position in the Binary.

      • length: number

        the number of bytes to read.

      返回 BinarySequence

    • 返回 string

    • Returns a string representation of an object.

      参数

      • 可选encoding: "utf8" | "utf-8" | "base64" | "hex"

      返回 string

    • 返回 UUID

    • Returns the value of this binary as a string.

      参数

      • 可选asRaw: boolean

        Will skip converting to a string

      返回 string | BinarySequence

      This is handy when calling this function conditionally for some key value pairs and not others

    • Writes a buffer or string to the binary.

      参数

      • sequence: string | BinarySequence

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

      • offset: number

        specify the binary of where to write the content.

      返回 void

    • Creates an Binary instance from a base64 string

      参数

      • base64: string
      • 可选subType: number

      返回 Binary

    • Creates an Binary instance from a hex digit string

      参数

      • hex: string
      • 可选subType: number

      返回 Binary