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 Buffer.byteLength
import { Buffer } from "https://deno.land/std@0.104.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
| ArrayBufferView
| ArrayBuffer
| SharedArrayBuffer
optional
encoding = [UNSUPPORTED]

Returns

number