INNER CODE UNIT · TypeScript
end
mongodb/js-bson · src/binary.ts:222
const end = position + length;
return this.buffer.subarray(position, end > this.position ? this.position : end);
}
/** returns a view of the binary value as a Uint8Array */
value(): Uint8Array {
// Optimize to serialize for the situation where the data == size of buffer
return this.buffer.length === this.position
? this.buffer
: this.buffer.subarray(0, this.position);
}
/** the length of the binary sequence */
length(): number {
return this.position;
}
toJSON(): string {