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

x/esm/server/embed/types/node.ns.d.ts>Buffer.from

A fast, global content delivery network for ES Modules.
Go to Latest
method Buffer.from
import { Buffer } from "https://deno.land/x/esm@v97/server/embed/types/node.ns.d.ts";

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: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>

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

optional
byteOffset: number
optional
length: number

Returns

Buffer

Creates a new Buffer using the passed {data}

Parameters

data: Uint8Array | ReadonlyArray<number>

data to create a new Buffer

Returns

Buffer

Parameters

data: WithImplicitCoercion<Uint8Array | ReadonlyArray<number> | string>

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: WithImplicitCoercion<string> | { [[Symbol.toPrimitive]](hint: "string"): string; }
optional
encoding: BufferEncoding

Returns

Buffer