Buffer
Properties
Functions
Compares buf
with target
and returns a number indicating whether buf
comes before, after, or is the same as target
in sort order. Comparison is based on the actual sequence of bytes in each Buffer
.
Returns true
if both buf
and otherBuffer
have exactly the same bytes,false
otherwise. Equivalent to buf.compare(otherBuffer) === 0
.
Fills buf
with the specified value
. If the offset
and end
are not given, the entire buf
will be filled:
Equivalent to buf.indexOf() !== -1
.
If value
is:
Identical to buf.indexOf()
, except the last occurrence of value
is found rather than the first occurrence.
Reads a signed, big-endian 64-bit integer from buf
at the specified offset
.
Reads a signed, little-endian 64-bit integer from buf
at the specifiedoffset
.
Reads an unsigned, big-endian 64-bit integer from buf
at the specifiedoffset
.
Reads an unsigned, little-endian 64-bit integer from buf
at the specifiedoffset
.
Reads a 64-bit, big-endian double from buf
at the specified offset
.
Reads a 64-bit, little-endian double from buf
at the specified offset
.
Reads a 32-bit, big-endian float from buf
at the specified offset
.
Reads a 32-bit, little-endian float from buf
at the specified offset
.
Reads a signed, big-endian 16-bit integer from buf
at the specified offset
.
Reads a signed, little-endian 16-bit integer from buf
at the specifiedoffset
.
Reads a signed, big-endian 32-bit integer from buf
at the specified offset
.
Reads a signed, little-endian 32-bit integer from buf
at the specifiedoffset
.
Reads an unsigned, big-endian 16-bit integer from buf
at the specifiedoffset
.
Reads an unsigned, little-endian 16-bit integer from buf
at the specified offset
.
Reads an unsigned, big-endian 32-bit integer from buf
at the specifiedoffset
.
Reads an unsigned, little-endian 32-bit integer from buf
at the specifiedoffset
.
Reads byteLength
number of bytes from buf
at the specified offset
and interprets the result as an unsigned big-endian integer supporting up to 48 bits of accuracy.
Reads byteLength
number of bytes from buf
at the specified offset
and interprets the result as an unsigned, little-endian integer supporting up to 48 bits of accuracy.
Returns a JSON representation of buf
. JSON.stringify()
implicitly calls this function when stringifying a Buffer
instance.
Decodes buf
to a string according to the specified character encoding inencoding
. start
and end
may be passed to decode only a subset of buf
.
Writes string
to buf
at offset
according to the character encoding inencoding
. The length
parameter is the number of bytes to write. If buf
did not contain enough space to fit the entire string, only part of string
will be written. However, partially encoded characters will not be written.
Writes value
to buf
at the specified offset
as big-endian.
Writes value
to buf
at the specified offset
as little-endian.
Writes value
to buf
at the specified offset
as big-endian.
Writes value
to buf
at the specified offset
as little-endian
Writes value
to buf
at the specified offset
as big-endian. The value
must be a JavaScript number. Behavior is undefined when value
is anything other than a JavaScript number.
Writes value
to buf
at the specified offset
as little-endian. The value
must be a JavaScript number. Behavior is undefined when value
is anything other than a JavaScript number.
Writes value
to buf
at the specified offset
as big-endian. Behavior is undefined when value
is anything other than a JavaScript number.
Writes value
to buf
at the specified offset
as little-endian. Behavior is undefined when value
is anything other than a JavaScript number.
Writes value
to buf
at the specified offset
as big-endian. The value
must be a valid signed 16-bit integer. Behavior is undefined when value
is anything other than a signed 16-bit integer.
Writes value
to buf
at the specified offset
as little-endian. The value
must be a valid signed 16-bit integer. Behavior is undefined when value
is anything other than a signed 16-bit integer.
Writes value
to buf
at the specified offset
as big-endian. The value
must be a valid signed 32-bit integer. Behavior is undefined when value
is anything other than a signed 32-bit integer.
Writes value
to buf
at the specified offset
as little-endian. The value
must be a valid signed 32-bit integer. Behavior is undefined when value
is anything other than a signed 32-bit integer.
Writes byteLength
bytes of value
to buf
at the specified offset
as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined whenvalue
is anything other than a signed integer.
Writes byteLength
bytes of value
to buf
at the specified offset
as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined when value
is anything other than a signed integer.
Writes value
to buf
at the specified offset
as big-endian. The value
must be a valid unsigned 16-bit integer. Behavior is undefined when value
is anything other than an unsigned 16-bit integer.
Writes value
to buf
at the specified offset
as little-endian. The value
must be a valid unsigned 16-bit integer. Behavior is undefined when value
is anything other than an unsigned 16-bit integer.
Writes value
to buf
at the specified offset
as big-endian. The value
must be a valid unsigned 32-bit integer. Behavior is undefined when value
is anything other than an unsigned 32-bit integer.
Writes value
to buf
at the specified offset
as little-endian. The value
must be a valid unsigned 32-bit integer. Behavior is undefined when value
is anything other than an unsigned 32-bit integer.
Writes value
to buf
at the specified offset
. value
must be a valid unsigned 8-bit integer. Behavior is undefined when value
is anything other than an unsigned 8-bit integer.
Writes byteLength
bytes of value
to buf
at the specified offset
as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined when value
is anything other than an unsigned integer.
Writes byteLength
bytes of value
to buf
at the specified offset
as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined when value
is anything other than an unsigned integer.