Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/gauntlet/imports/mod.ts>Buffer.from

Work-in-progress front-end tool which does put a smile on my face
Latest
method Buffer.from
import { Buffer } from "https://deno.land/x/gauntlet@v0.0.9/imports/mod.ts";

Allocates a new Buffer using an {array} of octets.

Parameters

array: any[]

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

The .buffer property of a TypedArray or a new ArrayBuffer()

optional
byteOffset: number
optional
length: number

Copies the passed {buffer} data onto a new Buffer instance.

Parameters

buffer: Buffer | Uint8Array

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: string