Properties
Functions
Allocates a new Buffer
of size
bytes. If fill
is undefined
, theBuffer
will be zero-filled.
Allocates a new Buffer
of size
bytes. If size
is larger than {@link constants.MAX_LENGTH} or smaller than 0, ERR_OUT_OF_RANGE
is thrown.
Allocates a new Buffer
of size
bytes. If size
is larger than {@link constants.MAX_LENGTH} or smaller than 0, ERR_OUT_OF_RANGE
is thrown. A zero-length Buffer
is created if size
is 0.
Returns the byte length of a string when encoded using encoding
. This is not the same as String.prototype.length
, which does not account for the encoding that is used to convert the string into bytes.
Copies the underlying memory of view
into a new Buffer
.
Allocates a new Buffer
using an array
of bytes in the range 0
– 255
. Array entries outside that range will be truncated to fit into it.
Creates a new Buffer
containing string
. The encoding
parameter identifies the character encoding to be used when converting string
into bytes.
This creates a view of the ArrayBuffer
without copying the underlying memory. For example, when passed a reference to the .buffer
property of a TypedArray
instance, the newly created Buffer
will share the same allocated memory as the TypedArray
's underlying ArrayBuffer
.
Returns true
if encoding
is the name of a supported character encoding, or false
otherwise.