import { Buffer } from "https://dotland.deno.dev/std@0.110.0/node/buffer.ts";
See also https://nodejs.org/api/buffer.html
Methods
Copies data from a region of buf to a region in target, even if the target memory region overlaps with buf.
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 new Buffer that references the same memory as the original, but offset and cropped by the start and end indices.
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 in encoding. start and end may be passed to decode only a subset of buf.
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 part of string will be written. However, partially encoded characters will not be written.
Static Methods
Returns the byte length of a string when encoded. 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.
Returns a new Buffer which is the result of concatenating all the Buffer instances in the list together.
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.
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.