A read-only binary value with support for binary deltas.
Values are effectively immutable. Instances can be backed by user-supplied buffers. Once a Binary has been constructed around a buffer, care must be taken not to modify the data in the buffer because doing so would violate immutability.
Get a copy of the buffer containing this value.
This value in binary form
Copy the binary data to a provided buffer.
the buffer to copy data to
the position in the target buffer at which data will be copied
Compare this Binary value with an earlier version to create a delta.
Convenient equivalent to:
Buffers may also be provided as the value to diff instead of a Binary instance.
var delta = binaryValue.diff(Buffer.from('Hello world'));
the value to diff against this
the type of delta to generate (default:
a delta representing the difference between this and the provided value
Get the value as a Buffer.
the buffer value
Get the number of bytes
The length of the data in bytes