The index operator [index] can be used to get and set the octet at position index in buf.
The index operator [index] can be used to get and set the octet at position index in buf. The values refer to individual bytes, so the legal value range is between 0x00 and 0xFF (hex) or 0 and 255 (decimal).
the given index
the value at the given index
Compares buf with target and returns a number indicating whether buf comes before, after, or is the same as target in sort order.
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.
A Buffer to compare to
The offset within target at which to begin comparison. Default: 0
The offset with target at which to end comparison (not inclusive). Ignored when targetStart is undefined. Default: target.length
The offset within buf at which to begin comparison. Ignored when targetStart is undefined. Default: 0
The offset within buf at which to end comparison (not inclusive). Ignored when targetStart is undefined. Default: buf.length
0 is returned if target is the same as buf 1 is returned if target should come before buf when sorted. -1 is returned if target should come after buf when sorted.
buf.compare(target[, targetStart[, targetEnd[, sourceStart[, sourceEnd]]]])
Copies data from a region of buf to a region in target even if the target memory region overlaps with buf.
Copies data from a region of buf to a region in target even if the target memory region overlaps with buf.
A Buffer to copy into.
The offset within target at which to begin copying to. Default: 0
The offset within buf at which to begin copying from. Ignored when targetStart is undefined. Default: 0
The offset within buf at which to stop copying (not inclusive). Ignored when sourceStart is undefined. Default: buf.length
The number of bytes copied.
buf.copy(target[, targetStart[, sourceStart[, sourceEnd]]])
Creates and returns an iterator of [index, byte] pairs from the Buffer contents.
Creates and returns an iterator of [index, byte] pairs from the Buffer contents.
an Iterator
Returns true if both buf and otherBuffer have exactly the same bytes, false otherwise.
Returns true if both buf and otherBuffer have exactly the same bytes, false otherwise.
A Buffer to compare to
true if both buf and otherBuffer have exactly the same bytes, false otherwise.
buf.equals(otherBuffer)
Fills buf with the specified value.
Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled. This is meant to be a small simplification to allow the creation and filling of a Buffer to be done on a single line.
The value to fill buf with
Where to start filling buf. Default: 0
Where to stop filling buf (not inclusive). Default: buf.length
If value is a string, this is its encoding. Default: 'utf8'
A reference to buf
buf.fill(value[, offset[, end]][, encoding])
Equivalent to buf.indexOf() !== -1.
Equivalent to buf.indexOf() !== -1.
What to search for
Where to begin searching in buf. Default: 0
If value is a string, this is its encoding. Default: 'utf8'
true if value was found in buf, false otherwise
buf.includes(value[, byteOffset][, encoding])
Returns the index of the first occurrence of value in buf or -1 if buf does not contain value
Returns the index of the first occurrence of value in buf or -1 if buf does not contain value
What to search for
Where to begin searching in buf. Default: 0
If value is a string, this is its encoding. Default: 'utf8'
The index of the first occurrence of value in buf or -1 if buf does not contain value
buf.indexOf(value[, byteOffset][, encoding])
The largest size allowed for a single Buffer instance.
The largest size allowed for a single Buffer instance. On 32-bit architectures, this value is (230)-1 (~1GB). On 64-bit architectures, this value is (231)-1 (~2GB). Note that this is a property on the buffer module returned by require('buffer'), not on the Buffer global or a Buffer instance.
the largest size allowed
Creates and returns an iterator of buf keys (indices).
Creates and returns an iterator of buf keys (indices).
an Iterator
buf.keys()
Identical to buf.indexOf(), except buf is searched from back to front instead of front to back.
Identical to buf.indexOf(), except buf is searched from back to front instead of front to back.
What to search for
Where to begin searching in buf. Default: 0
If value is a string, this is its encoding. Default: 'utf8'
The index of the last occurrence of value in buf or -1 if buf does not contain value
buf.lastIndexOf(value[, byteOffset][, encoding])
Returns the amount of memory allocated for buf in bytes.
Returns the amount of memory allocated for buf in bytes. Note that this does not necessarily reflect the amount of "usable" data within buf.
the amount of memory allocated for buf in bytes.
buf.length
Reads a 64-bit double from buf at the specified offset with specified endian format (readDoubleBE() returns big endian, readDoubleLE() returns little endian).
Reads a 64-bit double from buf at the specified offset with specified endian format (readDoubleBE() returns big endian, readDoubleLE() returns little endian).
Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - 8
Skip offset validation? Default: false
a Double value
buf.readDoubleBE(offset[, noAssert])
Reads a 64-bit double from buf at the specified offset with specified endian format (readDoubleBE() returns big endian, readDoubleLE() returns little endian).
Reads a 64-bit double from buf at the specified offset with specified endian format (readDoubleBE() returns big endian, readDoubleLE() returns little endian).
Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - 8
Skip offset validation? Default: false
a Double value
buf.readDoubleBE(offset[, noAssert])
Reads a 32-bit float from buf at the specified offset with specified endian format (readFloatBE() returns big endian, readFloatLE() returns little endian).
Reads a 32-bit float from buf at the specified offset with specified endian format (readFloatBE() returns big endian, readFloatLE() returns little endian).
Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - 4
Skip offset validation? Default: false
a Double value
buf.readFloatBE(offset[, noAssert])
Reads a 32-bit float from buf at the specified offset with specified endian format (readFloatBE() returns big endian, readFloatLE() returns little endian).
Reads a 32-bit float from buf at the specified offset with specified endian format (readFloatBE() returns big endian, readFloatLE() returns little endian).
Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - 4
Skip offset validation? Default: false
a Double value
buf.readFloatLE(offset[, noAssert])
Reads a signed 16-bit integer from buf at the specified offset with the specified endian format (readInt16BE() returns big endian, readInt16LE() returns little endian).
Reads a signed 16-bit integer from buf at the specified offset with the specified endian format (readInt16BE() returns big endian, readInt16LE() returns little endian).
Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Integers read from a Buffer are interpreted as two's complement signed values.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - 2
Skip offset validation? Default: false
the integer value
buf.readInt16BE(offset[, noAssert])
Reads a signed 16-bit integer from buf at the specified offset with the specified endian format (readInt16BE() returns big endian, readInt16LE() returns little endian).
Reads a signed 16-bit integer from buf at the specified offset with the specified endian format (readInt16BE() returns big endian, readInt16LE() returns little endian).
Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Integers read from a Buffer are interpreted as two's complement signed values.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - 2
Skip offset validation? Default: false
the integer value
buf.readInt16LE(offset[, noAssert])
Reads a signed 32-bit integer from buf at the specified offset with the specified endian format (readInt32BE() returns big endian, readInt32LE() returns little endian).
Reads a signed 32-bit integer from buf at the specified offset with the specified endian format (readInt32BE() returns big endian, readInt32LE() returns little endian).
Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Integers read from a Buffer are interpreted as two's complement signed values.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - 4
Skip offset validation? Default: false
the integer value
buf.readInt32BE(offset[, noAssert])
Reads a signed 32-bit integer from buf at the specified offset with the specified endian format (readInt32BE() returns big endian, readInt32LE() returns little endian).
Reads a signed 32-bit integer from buf at the specified offset with the specified endian format (readInt32BE() returns big endian, readInt32LE() returns little endian).
Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Integers read from a Buffer are interpreted as two's complement signed values.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - 4
Skip offset validation? Default: false
the integer value
buf.readInt32LE(offset[, noAssert])
Reads a signed 8-bit integer from buf at the specified offset.
Reads a signed 8-bit integer from buf at the specified offset.
Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Integers read from a Buffer are interpreted as two's complement signed values.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - 1
Skip offset validation? Default: false
the integer value
buf.readInt8(offset[, noAssert])
Reads byteLength number of bytes from buf at the specified offset and interprets the result as a two's complement signed value.
Reads byteLength number of bytes from buf at the specified offset and interprets the result as a two's complement signed value. Supports up to 48 bits of accuracy.
Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - byteLength
How many bytes to read. Must satisfy: 0 < byteLength <= 6
Skip offset and byteLength validation? Default: false
the integer value
buf.readIntBE(offset, byteLength[, noAssert])
Reads byteLength number of bytes from buf at the specified offset and interprets the result as a two's complement signed value.
Reads byteLength number of bytes from buf at the specified offset and interprets the result as a two's complement signed value. Supports up to 48 bits of accuracy.
Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - byteLength
How many bytes to read. Must satisfy: 0 < byteLength <= 6
Skip offset and byteLength validation? Default: false
the integer value
buf.readIntLE(offset, byteLength[, noAssert])
Reads an unsigned 16-bit integer from buf at the specified offset with specified endian format (readUInt16BE() returns big endian, readUInt16LE() returns little endian).
Reads an unsigned 16-bit integer from buf at the specified offset with specified endian format (readUInt16BE() returns big endian, readUInt16LE() returns little endian).
Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - 2
Skip offset validation? Default: false
the integer value
buf.readUInt16BE(offset[, noAssert])
Reads an unsigned 16-bit integer from buf at the specified offset with specified endian format (readUInt16BE() returns big endian, readUInt16LE() returns little endian).
Reads an unsigned 16-bit integer from buf at the specified offset with specified endian format (readUInt16BE() returns big endian, readUInt16LE() returns little endian).
Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - 2
Skip offset validation? Default: false
the integer value
buf.readUInt16LE(offset[, noAssert])
Reads an unsigned 32-bit integer from buf at the specified offset with specified endian format (readUInt32BE() returns big endian, readUInt32LE() returns little endian).
Reads an unsigned 32-bit integer from buf at the specified offset with specified endian format (readUInt32BE() returns big endian, readUInt32LE() returns little endian). * Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - 4
Skip offset validation? Default: false
the integer value
buf.readUInt32BE(offset[, noAssert])
Reads an unsigned 32-bit integer from buf at the specified offset with specified endian format (readUInt32BE() returns big endian, readUInt32LE() returns little endian).
Reads an unsigned 32-bit integer from buf at the specified offset with specified endian format (readUInt32BE() returns big endian, readUInt32LE() returns little endian). * Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - 4
Skip offset validation? Default: false
the integer value
buf.readUInt32LE(offset[, noAssert])
Reads an unsigned 8-bit integer from buf at the specified offset.
Reads an unsigned 8-bit integer from buf at the specified offset. Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - 1
Skip offset validation? Default: false
the integer value
buf.readUInt8(offset[, noAssert])
Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned integer.
Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned integer. Supports up to 48 bits of accuracy.
Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - byteLength
How many bytes to read. Must satisfy: 0 < byteLength <= 6
Skip offset and byteLength validation? Default: false
the integer value
buf.readUIntBE(offset, byteLength[, noAssert])
Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned integer.
Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned integer. Supports up to 48 bits of accuracy.
Setting noAssert to true allows offset to be beyond the end of buf, but the result should be considered undefined behavior.
Where to start reading. Must satisfy: 0 <= offset <= buf.length - byteLength
How many bytes to read. Must satisfy: 0 < byteLength <= 6
Skip offset and byteLength validation? Default: false
the integer value
buf.readUIntLE(offset, byteLength[, noAssert])
Returns a new Buffer that references the same memory as the original, but offset and cropped by the start and end indices.
Returns a new Buffer that references the same memory as the original, but offset and cropped by the start and end indices.
Note that modifying the new Buffer slice will modify the memory in the original Buffer because the allocated memory of the two objects overlap.
Where the new Buffer will start. Default: 0
Where the new Buffer will end (not inclusive). Default: buf.length
a Buffer
buf.slice([start[, end]])
Interprets buf as an array of unsigned 16-bit integers and swaps the byte-order in-place.
Interprets buf as an array of unsigned 16-bit integers and swaps the byte-order in-place. Throws a RangeError if buf.length is not a multiple of 2.
A reference to buf
buf.swap16()
Interprets buf as an array of unsigned 32-bit integers and swaps the byte-order in-place.
Interprets buf as an array of unsigned 32-bit integers and swaps the byte-order in-place. Throws a RangeError if buf.length is not a multiple of 4.
A reference to buf
buf.swap32()
Interprets buf as an array of unsigned 64-bit numbers and swaps the byte-order in-place.
Interprets buf as an array of unsigned 64-bit numbers and swaps the byte-order in-place. Throws a RangeError if buf.length is not a multiple of 8.
A reference to buf
buf.swap64()
Returns a JSON representation of buf.
Returns a JSON representation of buf. JSON.stringify() implicitly calls this function when stringifying a Buffer instance.
a JSON representation of buf.
buf.toJSON()
Decodes buf to a string according to the specified character encoding in encoding.
Decodes buf to a string according to the specified character encoding in encoding. start and end may be passed to decode only a subset of buf.
The character encoding to decode to. Default: 'utf8'
The byte offset to start decoding at. Default: 0
The byte offset to stop decoding at (not inclusive). Default: buf.length
a string according to the specified character encoding in encoding.
buf.toString([encoding[, start[, end]]])
Re-encodes the given Buffer instance from one character encoding to another.
Re-encodes the given Buffer instance from one character encoding to another. Returns a new Buffer instance. Throws if the fromEnc or toEnc specify invalid character encodings or if conversion from fromEnc to toEnc is not permitted.
A Buffer instance
The current encoding
To target encoding
a new Buffer
The index operator [index] can be used to get and set the octet at position index in buf.
The index operator [index] can be used to get and set the octet at position index in buf. The values refer to individual bytes, so the legal value range is between 0x00 and 0xFF (hex) or 0 and 255 (decimal).
the given index
Creates and returns an iterator for buf values (bytes).
Writes string to buf at offset according to the character encoding in encoding.
Writes string to buf at offset according to the character encoding in encoding. The length parameter is the number of bytes to write. If buf did not contain enough space to fit the entire string, only a partial amount of string will be written. However, partially encoded characters will not be written.
String to be written to buf
Where to start writing string. Default: 0
How many bytes to write. Default: buf.length - offset
The character encoding of string. Default: 'utf8'
the Number of bytes written
buf.write(string[, offset[, length]][, encoding])
Writes value to buf at the specified offset with specified endian format (writeDoubleBE() writes big endian, writeDoubleLE() writes little endian).
Writes value to buf at the specified offset with specified endian format (writeDoubleBE() writes big endian, writeDoubleLE() writes little endian). value should be a valid 64-bit double. Behavior is undefined when value is anything other than a 64-bit double.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - 8
Skip value and offset validation? Default: false
the offset plus the number of bytes written
buf.writeDoubleBE(value, offset[, noAssert])
Writes value to buf at the specified offset with specified endian format (writeDoubleBE() writes big endian, writeDoubleLE() writes little endian).
Writes value to buf at the specified offset with specified endian format (writeDoubleBE() writes big endian, writeDoubleLE() writes little endian). value should be a valid 64-bit double. Behavior is undefined when value is anything other than a 64-bit double.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - 8
Skip value and offset validation? Default: false
the offset plus the number of bytes written
buf.writeDoubleLE(value, offset[, noAssert])
Writes value to buf at the specified offset with specified endian format (writeFloatBE() writes big endian, writeFloatLE() writes little endian).
Writes value to buf at the specified offset with specified endian format (writeFloatBE() writes big endian, writeFloatLE() writes little endian). value should be a valid 32-bit float. Behavior is undefined when value is anything other than a 32-bit float.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - 4
Skip value and offset validation? Default: false
the offset plus the number of bytes written
buf.writeFloatBE(value, offset[, noAssert])
Writes value to buf at the specified offset with specified endian format (writeFloatBE() writes big endian, writeFloatLE() writes little endian).
Writes value to buf at the specified offset with specified endian format (writeFloatBE() writes big endian, writeFloatLE() writes little endian). value should be a valid 32-bit float. Behavior is undefined when value is anything other than a 32-bit float.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - 4
Skip value and offset validation? Default: false
the offset plus the number of bytes written
buf.writeFloatLE(value, offset[, noAssert])
Writes value to buf at the specified offset with specified endian format (writeInt16BE() writes big endian, writeInt16LE() writes little endian).
Writes value to buf at the specified offset with specified endian format (writeInt16BE() writes big endian, writeInt16LE() writes little endian). value should be a valid signed 16-bit integer. Behavior is undefined when value is anything other than a signed 16-bit integer.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
value is interpreted and written as a two's complement signed integer.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - 2
Skip value and offset validation? Default: false
the offset plus the number of bytes written
buf.writeInt16BE(value, offset[, noAssert])
Writes value to buf at the specified offset with specified endian format (writeInt16BE() writes big endian, writeInt16LE() writes little endian).
Writes value to buf at the specified offset with specified endian format (writeInt16BE() writes big endian, writeInt16LE() writes little endian). value should be a valid signed 16-bit integer. Behavior is undefined when value is anything other than a signed 16-bit integer.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
value is interpreted and written as a two's complement signed integer.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - 2
Skip value and offset validation? Default: false
the offset plus the number of bytes written
buf.writeInt16BE(value, offset[, noAssert])
Writes value to buf at the specified offset with specified endian format (writeInt32BE() writes big endian, writeInt32LE() writes little endian).
Writes value to buf at the specified offset with specified endian format (writeInt32BE() writes big endian, writeInt32LE() writes little endian). value should be a valid signed 32-bit integer. Behavior is undefined when value is anything other than a signed 32-bit integer.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
value is interpreted and written as a two's complement signed integer.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - 4
Skip value and offset validation? Default: false
the offset plus the number of bytes written
buf.writeInt32BE(value, offset[, noAssert])
Writes value to buf at the specified offset with specified endian format (writeInt32BE() writes big endian, writeInt32LE() writes little endian).
Writes value to buf at the specified offset with specified endian format (writeInt32BE() writes big endian, writeInt32LE() writes little endian). value should be a valid signed 32-bit integer. Behavior is undefined when value is anything other than a signed 32-bit integer.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
value is interpreted and written as a two's complement signed integer.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - 4
Skip value and offset validation? Default: false
the offset plus the number of bytes written
buf.writeInt32BE(value, offset[, noAssert])
Writes value to buf at the specified offset.
Writes value to buf at the specified offset. value should be a valid signed 8-bit integer. Behavior is undefined when value is anything other than a signed 8-bit integer.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
value is interpreted and written as a two's complement signed integer.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - 1
Skip value and offset validation? Default: false
the offset plus the number of bytes written
buf.writeInt8(value, offset[, noAssert])
Writes byteLength bytes of value to buf at the specified offset.
Writes byteLength bytes of value to buf at the specified offset. Supports up to 48 bits of accuracy. Behavior is undefined when value is anything other than a signed integer.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - byteLength
How many bytes to write. Must satisfy: 0 < byteLength <= 6
Skip value, offset, and byteLength validation? Default: false
the offset plus the number of bytes written
buf.writeIntBE(value, offset, byteLength[, noAssert])
Writes byteLength bytes of value to buf at the specified offset.
Writes byteLength bytes of value to buf at the specified offset. Supports up to 48 bits of accuracy. Behavior is undefined when value is anything other than a signed integer.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - byteLength
How many bytes to write. Must satisfy: 0 < byteLength <= 6
Skip value, offset, and byteLength validation? Default: false
the offset plus the number of bytes written
buf.writeIntLE(value, offset, byteLength[, noAssert])
Writes value to buf at the specified offset with specified endian format (writeUInt16BE() writes big endian, writeUInt16LE() writes little endian).
Writes value to buf at the specified offset with specified endian format (writeUInt16BE() writes big endian, writeUInt16LE() writes little endian). value should be a valid unsigned 16-bit integer. Behavior is undefined when value is anything other than an unsigned 16-bit integer.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
Number to be written to buf
Number to be written to buf
Skip value and offset validation? Default: false
the offset plus the number of bytes written
buf.writeUInt16BE(value, offset[, noAssert])
Writes value to buf at the specified offset with specified endian format (writeUInt16BE() writes big endian, writeUInt16LE() writes little endian).
Writes value to buf at the specified offset with specified endian format (writeUInt16BE() writes big endian, writeUInt16LE() writes little endian). value should be a valid unsigned 16-bit integer. Behavior is undefined when value is anything other than an unsigned 16-bit integer.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
Number to be written to buf
Number to be written to buf
Skip value and offset validation? Default: false
the offset plus the number of bytes written
buf.writeUInt16BE(value, offset[, noAssert])
Writes value to buf at the specified offset with specified endian format (writeUInt32BE() writes big endian, writeUInt32LE() writes little endian).
Writes value to buf at the specified offset with specified endian format (writeUInt32BE() writes big endian, writeUInt32LE() writes little endian). value should be a valid unsigned 32-bit integer. Behavior is undefined when value is anything other than an unsigned 32-bit integer.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - 4
Skip value and offset validation? Default: false
the offset plus the number of bytes written
buf.writeUInt32BE(value, offset[, noAssert])
Writes value to buf at the specified offset with specified endian format (writeUInt32BE() writes big endian, writeUInt32LE() writes little endian).
Writes value to buf at the specified offset with specified endian format (writeUInt32BE() writes big endian, writeUInt32LE() writes little endian). value should be a valid unsigned 32-bit integer. Behavior is undefined when value is anything other than an unsigned 32-bit integer.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - 4
Skip value and offset validation? Default: false
the offset plus the number of bytes written
buf.writeUInt32LE(value, offset[, noAssert])
Writes value to buf at the specified offset.
Writes value to buf at the specified offset. value should be a valid unsigned 8-bit integer. Behavior is undefined when value is anything other than an unsigned 8-bit integer.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - 1
Skip value and offset validation? Default: false
the offset plus the number of bytes written
buf.writeUInt8(value, offset[, noAssert])
Writes byteLength bytes of value to buf at the specified offset.
Writes byteLength bytes of value to buf at the specified offset. Supports up to 48 bits of accuracy. Behavior is undefined when value is anything other than an unsigned integer.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - byteLength
How many bytes to write. Must satisfy: 0 < byteLength <= 6
Skip value, offset, and byteLength validation? Default: false
the offset plus the number of bytes written
buf.writeUIntBE(value, offset, byteLength[, noAssert])
Writes byteLength bytes of value to buf at the specified offset.
Writes byteLength bytes of value to buf at the specified offset. Supports up to 48 bits of accuracy. Behavior is undefined when value is anything other than an unsigned integer.
Setting noAssert to true allows the encoded form of value to extend beyond the end of buf, but the result should be considered undefined behavior.
Number to be written to buf
Where to start writing. Must satisfy: 0 <= offset <= buf.length - byteLength
How many bytes to write. Must satisfy: 0 < byteLength <= 6
Skip value, offset, and byteLength validation? Default: false
the offset plus the number of bytes written
buf.writeUIntLE(value, offset, byteLength[, noAssert])
Returns an un-pooled Buffer.
In order to avoid the garbage collection overhead of creating many individually allocated Buffer instances, by default allocations under 4KB are sliced from a single larger allocated object. This approach improves both performance and memory usage since v8 does not need to track and cleanup as many Persistent objects.
In the case where a developer may need to retain a small chunk of memory from a pool for an indeterminate amount of time, it may be appropriate to create an un-pooled Buffer instance using SlowBuffer then copy out the relevant bits.
(Since version 6.0.0) Use Buffer.allocUnsafeSlow() instead.
https://nodejs.org/api/buffer.html#buffer_class_slowbuffer