if specified, buffer will be initialized by calling buf.fill(fill).
If parameter is omitted, buffer will be filled with zeros.
Optional encoding: undefined | string
encoding used for call to buf.fill while initalizing
Returns Buffer
allocUnsafe: function
allocUnsafe(size: number): Buffer
Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
of the newly created Buffer are unknown and may contain sensitive data.
Parameters
size: number
count of octets to allocate
Returns Buffer
allocUnsafeSlow: function
allocUnsafeSlow(size: number): Buffer
Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
of the newly created Buffer are unknown and may contain sensitive data.
Gives the actual byte length of a string. encoding defaults to 'utf8'.
This is not the same as String.prototype.length since that returns the number of characters in a string.
Returns a buffer which is the result of concatenating all the buffers in the list together.
If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
If the list has exactly one item, then the first item of the list is returned.
If the list has more than one item, then a new Buffer is created.
Parameters
list: Uint8Array[]
An array of Buffer objects to concatenate
Optional totalLength: undefined | number
Total length of the buffers when concatenated.
If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
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.
The optional {byteOffset} and {length} arguments specify a memory range
within the {arrayBuffer} that will be shared by the Buffer.
Parameters
arrayBuffer: ArrayBuffer | SharedArrayBuffer
The .buffer property of any TypedArray or a new ArrayBuffer()
Optional byteOffset: undefined | number
Optional length: undefined | number
Returns Buffer
Creates a new Buffer using the passed {data}
Parameters
data: any[]
data to create a new Buffer
Returns Buffer
Parameters
data: Uint8Array
Returns Buffer
Creates a new Buffer containing the given JavaScript string {str}.
If provided, the {encoding} parameter identifies the character encoding.
If not provided, {encoding} defaults to 'utf8'.
Parameters
str: string
Optional encoding: undefined | string
Returns Buffer
isBuffer: function
isBuffer(obj: any): boolean
Returns true if {obj} is a Buffer
Parameters
obj: any
object to test.
Returns boolean
isEncoding: function
isEncoding(encoding: string): boolean | undefined
Returns true if {encoding} is a valid encoding argument.
Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
Allocates a new buffer containing the given {str}.
since v10.0.0 - Use
Buffer.from(string[, encoding])
instead.