|
@ -43,18 +43,19 @@ Allocates a new buffer of `size` octets. |
|
|
|
|
|
|
|
|
Allocates a new buffer using an `array` of octets. |
|
|
Allocates a new buffer using an `array` of octets. |
|
|
|
|
|
|
|
|
### new Buffer(str, encoding='utf8') |
|
|
### new Buffer(str, [encoding]) |
|
|
|
|
|
|
|
|
Allocates a new buffer containing the given `str`. |
|
|
Allocates a new buffer containing the given `str`. |
|
|
|
|
|
`encoding` defaults to `'utf8'`. |
|
|
|
|
|
|
|
|
### buffer.write(string, offset=0, length=buffer.length-offset, encoding='utf8') |
|
|
### buffer.write(string, [offset], [length], [encoding]) |
|
|
|
|
|
|
|
|
Writes `string` to the buffer at `offset` using the given encoding. `length` is |
|
|
Writes `string` to the buffer at `offset` using the given encoding. |
|
|
|
|
|
`offset` defaults to `0`, `encoding` defaults to `'utf8'`. `length` is |
|
|
the number of bytes to write. Returns number of octets written. If `buffer` did |
|
|
the number of bytes to write. Returns number of octets written. If `buffer` did |
|
|
not contain enough space to fit the entire string, it will write a partial |
|
|
not contain enough space to fit the entire string, it will write a partial |
|
|
amount of the string. The method will not write partial characters. |
|
|
amount of the string. `length` defaults to `buffer.length - offset`. |
|
|
|
|
|
The method will not write partial characters. |
|
|
Example: write a utf8 string into a buffer, then print it |
|
|
|
|
|
|
|
|
|
|
|
buf = new Buffer(256); |
|
|
buf = new Buffer(256); |
|
|
len = buf.write('\u00bd + \u00bc = \u00be', 0); |
|
|
len = buf.write('\u00bd + \u00bc = \u00be', 0); |
|
@ -65,10 +66,11 @@ bytes written) is set in `Buffer._charsWritten` and will be overwritten the |
|
|
next time `buf.write()` is called. |
|
|
next time `buf.write()` is called. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### buffer.toString(encoding, start=0, end=buffer.length) |
|
|
### buffer.toString(encoding, [start], [end]) |
|
|
|
|
|
|
|
|
Decodes and returns a string from buffer data encoded with `encoding` |
|
|
Decodes and returns a string from buffer data encoded with `encoding` |
|
|
beginning at `start` and ending at `end`. |
|
|
(defaults to `'utf8'`) beginning at `start` (defaults to `0`) and ending at |
|
|
|
|
|
`end` (defaults to `buffer.length`). |
|
|
|
|
|
|
|
|
See `buffer.write()` example, above. |
|
|
See `buffer.write()` example, above. |
|
|
|
|
|
|
|
@ -95,11 +97,11 @@ Example: copy an ASCII string into a buffer, one byte at a time: |
|
|
|
|
|
|
|
|
Tests if `obj` is a `Buffer`. |
|
|
Tests if `obj` is a `Buffer`. |
|
|
|
|
|
|
|
|
### Buffer.byteLength(string, encoding='utf8') |
|
|
### Buffer.byteLength(string, [encoding]) |
|
|
|
|
|
|
|
|
Gives the actual byte length of a string. This is not the same as |
|
|
Gives the actual byte length of a string. `encoding` defaults to `'utf8'`. |
|
|
`String.prototype.length` since that returns the number of *characters* in a |
|
|
This is not the same as `String.prototype.length` since that returns the |
|
|
string. |
|
|
number of *characters* in a string. |
|
|
|
|
|
|
|
|
Example: |
|
|
Example: |
|
|
|
|
|
|
|
@ -126,9 +128,11 @@ buffer object. It does not change when the contents of the buffer are changed. |
|
|
// 1234 |
|
|
// 1234 |
|
|
// 1234 |
|
|
// 1234 |
|
|
|
|
|
|
|
|
### buffer.copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) |
|
|
### buffer.copy(targetBuffer, [targetStart], [sourceStart], [sourceEnd]) |
|
|
|
|
|
|
|
|
Does copy between buffers. The source and target regions can be overlapped. |
|
|
Does copy between buffers. The source and target regions can be overlapped. |
|
|
|
|
|
`targetStart` and `sourceStart` default to `0`. |
|
|
|
|
|
`sourceEnd` defaults to `buffer.length`. |
|
|
|
|
|
|
|
|
Example: build two Buffers, then copy `buf1` from byte 16 through byte 19 |
|
|
Example: build two Buffers, then copy `buf1` from byte 16 through byte 19 |
|
|
into `buf2`, starting at the 8th byte in `buf2`. |
|
|
into `buf2`, starting at the 8th byte in `buf2`. |
|
@ -147,11 +151,11 @@ into `buf2`, starting at the 8th byte in `buf2`. |
|
|
// !!!!!!!!qrst!!!!!!!!!!!!! |
|
|
// !!!!!!!!qrst!!!!!!!!!!!!! |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### buffer.slice(start, end=buffer.length) |
|
|
### buffer.slice([start], [end]) |
|
|
|
|
|
|
|
|
Returns a new buffer which references the |
|
|
Returns a new buffer which references the same memory as the old, but offset |
|
|
same memory as the old, but offset and cropped by the `start` and `end` |
|
|
and cropped by the `start` (defaults to `0`) and `end` (defaults to |
|
|
indexes. |
|
|
`buffer.length`) indexes. |
|
|
|
|
|
|
|
|
**Modifying the new buffer slice will modify memory in the original buffer!** |
|
|
**Modifying the new buffer slice will modify memory in the original buffer!** |
|
|
|
|
|
|
|
@ -172,12 +176,12 @@ byte from the original Buffer. |
|
|
// abc |
|
|
// abc |
|
|
// !bc |
|
|
// !bc |
|
|
|
|
|
|
|
|
### buffer.readUInt8(offset, noAssert=false) |
|
|
### buffer.readUInt8(offset, [noAssert]) |
|
|
|
|
|
|
|
|
Reads an unsigned 8 bit integer from the buffer at the specified offset. |
|
|
Reads an unsigned 8 bit integer from the buffer at the specified offset. |
|
|
|
|
|
|
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
may be beyond the end of the buffer. |
|
|
may be beyond the end of the buffer. Defaults to `false`. |
|
|
|
|
|
|
|
|
Example: |
|
|
Example: |
|
|
|
|
|
|
|
@ -197,14 +201,14 @@ Example: |
|
|
// 0x23 |
|
|
// 0x23 |
|
|
// 0x42 |
|
|
// 0x42 |
|
|
|
|
|
|
|
|
### buffer.readUInt16LE(offset, noAssert=false) |
|
|
### buffer.readUInt16LE(offset, [noAssert]) |
|
|
### buffer.readUInt16BE(offset, noAssert=false) |
|
|
### buffer.readUInt16BE(offset, [noAssert]) |
|
|
|
|
|
|
|
|
Reads an unsigned 16 bit integer from the buffer at the specified offset with |
|
|
Reads an unsigned 16 bit integer from the buffer at the specified offset with |
|
|
specified endian format. |
|
|
specified endian format. |
|
|
|
|
|
|
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
may be beyond the end of the buffer. |
|
|
may be beyond the end of the buffer. Defaults to `false`. |
|
|
|
|
|
|
|
|
Example: |
|
|
Example: |
|
|
|
|
|
|
|
@ -229,14 +233,14 @@ Example: |
|
|
// 0x2342 |
|
|
// 0x2342 |
|
|
// 0x4223 |
|
|
// 0x4223 |
|
|
|
|
|
|
|
|
### buffer.readUInt32LE(offset, noAssert=false) |
|
|
### buffer.readUInt32LE(offset, [noAssert]) |
|
|
### buffer.readUInt32BE(offset, noAssert=false) |
|
|
### buffer.readUInt32BE(offset, [noAssert]) |
|
|
|
|
|
|
|
|
Reads an unsigned 32 bit integer from the buffer at the specified offset with |
|
|
Reads an unsigned 32 bit integer from the buffer at the specified offset with |
|
|
specified endian format. |
|
|
specified endian format. |
|
|
|
|
|
|
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
may be beyond the end of the buffer. |
|
|
may be beyond the end of the buffer. Defaults to `false`. |
|
|
|
|
|
|
|
|
Example: |
|
|
Example: |
|
|
|
|
|
|
|
@ -253,48 +257,48 @@ Example: |
|
|
// 0x03042342 |
|
|
// 0x03042342 |
|
|
// 0x42230403 |
|
|
// 0x42230403 |
|
|
|
|
|
|
|
|
### buffer.readInt8(offset, noAssert=false) |
|
|
### buffer.readInt8(offset, [noAssert]) |
|
|
|
|
|
|
|
|
Reads a signed 8 bit integer from the buffer at the specified offset. |
|
|
Reads a signed 8 bit integer from the buffer at the specified offset. |
|
|
|
|
|
|
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
may be beyond the end of the buffer. |
|
|
may be beyond the end of the buffer. Defaults to `false`. |
|
|
|
|
|
|
|
|
Works as `buffer.readUInt8`, except buffer contents are treated as two's |
|
|
Works as `buffer.readUInt8`, except buffer contents are treated as two's |
|
|
complement signed values. |
|
|
complement signed values. |
|
|
|
|
|
|
|
|
### buffer.readInt16LE(offset, noAssert=false) |
|
|
### buffer.readInt16LE(offset, [noAssert]) |
|
|
### buffer.readInt16BE(offset, noAssert=false) |
|
|
### buffer.readInt16BE(offset, [noAssert]) |
|
|
|
|
|
|
|
|
Reads a signed 16 bit integer from the buffer at the specified offset with |
|
|
Reads a signed 16 bit integer from the buffer at the specified offset with |
|
|
specified endian format. |
|
|
specified endian format. |
|
|
|
|
|
|
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
may be beyond the end of the buffer. |
|
|
may be beyond the end of the buffer. Defaults to `false`. |
|
|
|
|
|
|
|
|
Works as `buffer.readUInt16*`, except buffer contents are treated as two's |
|
|
Works as `buffer.readUInt16*`, except buffer contents are treated as two's |
|
|
complement signed values. |
|
|
complement signed values. |
|
|
|
|
|
|
|
|
### buffer.readInt32LE(offset, noAssert=false) |
|
|
### buffer.readInt32LE(offset, [noAssert]) |
|
|
### buffer.readInt32BE(offset, noAssert=false) |
|
|
### buffer.readInt32BE(offset, [noAssert]) |
|
|
|
|
|
|
|
|
Reads a signed 32 bit integer from the buffer at the specified offset with |
|
|
Reads a signed 32 bit integer from the buffer at the specified offset with |
|
|
specified endian format. |
|
|
specified endian format. |
|
|
|
|
|
|
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
may be beyond the end of the buffer. |
|
|
may be beyond the end of the buffer. Defaults to `false`. |
|
|
|
|
|
|
|
|
Works as `buffer.readUInt32*`, except buffer contents are treated as two's |
|
|
Works as `buffer.readUInt32*`, except buffer contents are treated as two's |
|
|
complement signed values. |
|
|
complement signed values. |
|
|
|
|
|
|
|
|
### buffer.readFloatLE(offset, noAssert=false) |
|
|
### buffer.readFloatLE(offset, [noAssert]) |
|
|
### buffer.readFloatBE(offset, noAssert=false) |
|
|
### buffer.readFloatBE(offset, [noAssert]) |
|
|
|
|
|
|
|
|
Reads a 32 bit float from the buffer at the specified offset with specified |
|
|
Reads a 32 bit float from the buffer at the specified offset with specified |
|
|
endian format. |
|
|
endian format. |
|
|
|
|
|
|
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
may be beyond the end of the buffer. |
|
|
may be beyond the end of the buffer. Defaults to `false`. |
|
|
|
|
|
|
|
|
Example: |
|
|
Example: |
|
|
|
|
|
|
|
@ -309,14 +313,14 @@ Example: |
|
|
|
|
|
|
|
|
// 0x01 |
|
|
// 0x01 |
|
|
|
|
|
|
|
|
### buffer.readDoubleLE(offset, noAssert=false) |
|
|
### buffer.readDoubleLE(offset, [noAssert]) |
|
|
### buffer.readDoubleBE(offset, noAssert=false) |
|
|
### buffer.readDoubleBE(offset, [noAssert]) |
|
|
|
|
|
|
|
|
Reads a 64 bit double from the buffer at the specified offset with specified |
|
|
Reads a 64 bit double from the buffer at the specified offset with specified |
|
|
endian format. |
|
|
endian format. |
|
|
|
|
|
|
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
Set `noAssert` to true to skip validation of `offset`. This means that `offset` |
|
|
may be beyond the end of the buffer. |
|
|
may be beyond the end of the buffer. Defaults to `false`. |
|
|
|
|
|
|
|
|
Example: |
|
|
Example: |
|
|
|
|
|
|
|
@ -335,7 +339,7 @@ Example: |
|
|
|
|
|
|
|
|
// 0.3333333333333333 |
|
|
// 0.3333333333333333 |
|
|
|
|
|
|
|
|
### buffer.writeUInt8(value, offset, noAssert=false) |
|
|
### buffer.writeUInt8(value, offset, [noAssert]) |
|
|
|
|
|
|
|
|
Writes `value` to the buffer at the specified offset. Note, `value` must be a |
|
|
Writes `value` to the buffer at the specified offset. Note, `value` must be a |
|
|
valid unsigned 8 bit integer. |
|
|
valid unsigned 8 bit integer. |
|
@ -343,7 +347,7 @@ valid unsigned 8 bit integer. |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
should not be used unless you are certain of correctness. |
|
|
should not be used unless you are certain of correctness. Defaults to `false`. |
|
|
|
|
|
|
|
|
Example: |
|
|
Example: |
|
|
|
|
|
|
|
@ -357,8 +361,8 @@ Example: |
|
|
|
|
|
|
|
|
// <Buffer 03 04 23 42> |
|
|
// <Buffer 03 04 23 42> |
|
|
|
|
|
|
|
|
### buffer.writeUInt16LE(value, offset, noAssert=false) |
|
|
### buffer.writeUInt16LE(value, offset, [noAssert]) |
|
|
### buffer.writeUInt16BE(value, offset, noAssert=false) |
|
|
### buffer.writeUInt16BE(value, offset, [noAssert]) |
|
|
|
|
|
|
|
|
Writes `value` to the buffer at the specified offset with specified endian |
|
|
Writes `value` to the buffer at the specified offset with specified endian |
|
|
format. Note, `value` must be a valid unsigned 16 bit integer. |
|
|
format. Note, `value` must be a valid unsigned 16 bit integer. |
|
@ -366,7 +370,7 @@ format. Note, `value` must be a valid unsigned 16 bit integer. |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
should not be used unless you are certain of correctness. |
|
|
should not be used unless you are certain of correctness. Defaults to `false`. |
|
|
|
|
|
|
|
|
Example: |
|
|
Example: |
|
|
|
|
|
|
|
@ -384,8 +388,8 @@ Example: |
|
|
// <Buffer de ad be ef> |
|
|
// <Buffer de ad be ef> |
|
|
// <Buffer ad de ef be> |
|
|
// <Buffer ad de ef be> |
|
|
|
|
|
|
|
|
### buffer.writeUInt32LE(value, offset, noAssert=false) |
|
|
### buffer.writeUInt32LE(value, offset, [noAssert]) |
|
|
### buffer.writeUInt32BE(value, offset, noAssert=false) |
|
|
### buffer.writeUInt32BE(value, offset, [noAssert]) |
|
|
|
|
|
|
|
|
Writes `value` to the buffer at the specified offset with specified endian |
|
|
Writes `value` to the buffer at the specified offset with specified endian |
|
|
format. Note, `value` must be a valid unsigned 32 bit integer. |
|
|
format. Note, `value` must be a valid unsigned 32 bit integer. |
|
@ -393,7 +397,7 @@ format. Note, `value` must be a valid unsigned 32 bit integer. |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
should not be used unless you are certain of correctness. |
|
|
should not be used unless you are certain of correctness. Defaults to `false`. |
|
|
|
|
|
|
|
|
Example: |
|
|
Example: |
|
|
|
|
|
|
|
@ -409,7 +413,7 @@ Example: |
|
|
// <Buffer fe ed fa ce> |
|
|
// <Buffer fe ed fa ce> |
|
|
// <Buffer ce fa ed fe> |
|
|
// <Buffer ce fa ed fe> |
|
|
|
|
|
|
|
|
### buffer.writeInt8(value, offset, noAssert=false) |
|
|
### buffer.writeInt8(value, offset, [noAssert]) |
|
|
|
|
|
|
|
|
Writes `value` to the buffer at the specified offset. Note, `value` must be a |
|
|
Writes `value` to the buffer at the specified offset. Note, `value` must be a |
|
|
valid signed 8 bit integer. |
|
|
valid signed 8 bit integer. |
|
@ -417,13 +421,13 @@ valid signed 8 bit integer. |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
should not be used unless you are certain of correctness. |
|
|
should not be used unless you are certain of correctness. Defaults to `false`. |
|
|
|
|
|
|
|
|
Works as `buffer.writeUInt8`, except value is written out as a two's complement |
|
|
Works as `buffer.writeUInt8`, except value is written out as a two's complement |
|
|
signed integer into `buffer`. |
|
|
signed integer into `buffer`. |
|
|
|
|
|
|
|
|
### buffer.writeInt16LE(value, offset, noAssert=false) |
|
|
### buffer.writeInt16LE(value, offset, [noAssert]) |
|
|
### buffer.writeInt16BE(value, offset, noAssert=false) |
|
|
### buffer.writeInt16BE(value, offset, [noAssert]) |
|
|
|
|
|
|
|
|
Writes `value` to the buffer at the specified offset with specified endian |
|
|
Writes `value` to the buffer at the specified offset with specified endian |
|
|
format. Note, `value` must be a valid signed 16 bit integer. |
|
|
format. Note, `value` must be a valid signed 16 bit integer. |
|
@ -431,13 +435,13 @@ format. Note, `value` must be a valid signed 16 bit integer. |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
should not be used unless you are certain of correctness. |
|
|
should not be used unless you are certain of correctness. Defaults to `false`. |
|
|
|
|
|
|
|
|
Works as `buffer.writeUInt16*`, except value is written out as a two's |
|
|
Works as `buffer.writeUInt16*`, except value is written out as a two's |
|
|
complement signed integer into `buffer`. |
|
|
complement signed integer into `buffer`. |
|
|
|
|
|
|
|
|
### buffer.writeInt32LE(value, offset, noAssert=false) |
|
|
### buffer.writeInt32LE(value, offset, [noAssert]) |
|
|
### buffer.writeInt32BE(value, offset, noAssert=false) |
|
|
### buffer.writeInt32BE(value, offset, [noAssert]) |
|
|
|
|
|
|
|
|
Writes `value` to the buffer at the specified offset with specified endian |
|
|
Writes `value` to the buffer at the specified offset with specified endian |
|
|
format. Note, `value` must be a valid signed 32 bit integer. |
|
|
format. Note, `value` must be a valid signed 32 bit integer. |
|
@ -445,13 +449,13 @@ format. Note, `value` must be a valid signed 32 bit integer. |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
should not be used unless you are certain of correctness. |
|
|
should not be used unless you are certain of correctness. Defaults to `false`. |
|
|
|
|
|
|
|
|
Works as `buffer.writeUInt32*`, except value is written out as a two's |
|
|
Works as `buffer.writeUInt32*`, except value is written out as a two's |
|
|
complement signed integer into `buffer`. |
|
|
complement signed integer into `buffer`. |
|
|
|
|
|
|
|
|
### buffer.writeFloatLE(value, offset, noAssert=false) |
|
|
### buffer.writeFloatLE(value, offset, [noAssert]) |
|
|
### buffer.writeFloatBE(value, offset, noAssert=false) |
|
|
### buffer.writeFloatBE(value, offset, [noAssert]) |
|
|
|
|
|
|
|
|
Writes `value` to the buffer at the specified offset with specified endian |
|
|
Writes `value` to the buffer at the specified offset with specified endian |
|
|
format. Note, `value` must be a valid 32 bit float. |
|
|
format. Note, `value` must be a valid 32 bit float. |
|
@ -459,7 +463,7 @@ format. Note, `value` must be a valid 32 bit float. |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
should not be used unless you are certain of correctness. |
|
|
should not be used unless you are certain of correctness. Defaults to `false`. |
|
|
|
|
|
|
|
|
Example: |
|
|
Example: |
|
|
|
|
|
|
|
@ -475,8 +479,8 @@ Example: |
|
|
// <Buffer 4f 4a fe bb> |
|
|
// <Buffer 4f 4a fe bb> |
|
|
// <Buffer bb fe 4a 4f> |
|
|
// <Buffer bb fe 4a 4f> |
|
|
|
|
|
|
|
|
### buffer.writeDoubleLE(value, offset, noAssert=false) |
|
|
### buffer.writeDoubleLE(value, offset, [noAssert]) |
|
|
### buffer.writeDoubleBE(value, offset, noAssert=false) |
|
|
### buffer.writeDoubleBE(value, offset, [noAssert]) |
|
|
|
|
|
|
|
|
Writes `value` to the buffer at the specified offset with specified endian |
|
|
Writes `value` to the buffer at the specified offset with specified endian |
|
|
format. Note, `value` must be a valid 64 bit double. |
|
|
format. Note, `value` must be a valid 64 bit double. |
|
@ -484,7 +488,7 @@ format. Note, `value` must be a valid 64 bit double. |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
Set `noAssert` to true to skip validation of `value` and `offset`. This means |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
that `value` may be too large for the specific function and `offset` may be |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
beyond the end of the buffer leading to the values being silently dropped. This |
|
|
should not be used unless you are certain of correctness. |
|
|
should not be used unless you are certain of correctness. Defaults to `false`. |
|
|
|
|
|
|
|
|
Example: |
|
|
Example: |
|
|
|
|
|
|
|
@ -500,10 +504,11 @@ Example: |
|
|
// <Buffer 43 eb d5 b7 dd f9 5f d7> |
|
|
// <Buffer 43 eb d5 b7 dd f9 5f d7> |
|
|
// <Buffer d7 5f f9 dd b7 d5 eb 43> |
|
|
// <Buffer d7 5f f9 dd b7 d5 eb 43> |
|
|
|
|
|
|
|
|
### buffer.fill(value, offset=0, end=buffer.length) |
|
|
### buffer.fill(value, [offset], [end]) |
|
|
|
|
|
|
|
|
Fills the buffer with the specified value. If the offset and end are not |
|
|
Fills the buffer with the specified value. If the `offset` (defaults to `0`) |
|
|
given it will fill the entire buffer. |
|
|
and `end` (defaults to `buffer.length`) are not given it will fill the entire |
|
|
|
|
|
buffer. |
|
|
|
|
|
|
|
|
var b = new Buffer(50); |
|
|
var b = new Buffer(50); |
|
|
b.fill("h"); |
|
|
b.fill("h"); |
|
|