• Node.js Video Tutorials

Node.js - Buffer.length property



The NodeJS Buffer.length is a property of the class Buffer in NodeJS Buffer Module. This property will give you the no of bytes in the buffer.

Syntax

Following is the syntax of the NodeJS Buffer length property −

Buffer.length

Example

In this example will create a buffer and see the output for Buffer.length.

const buf = Buffer.from('Hello World');
console.log("The length of buffer is:"+buf.length);

Output

The length of buffer is:11
nodejs_buffer_module.htm
Advertisements