Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
method default.byteLength
import { default } from "https://deno.land/std@0.74.0/node/buffer.ts";

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.

Parameters

string:
| string
| Buffer
| ArrayBufferView
| ArrayBuffer
| SharedArrayBuffer
optional
encoding = [UNSUPPORTED]

Returns

number