Everyone who worked in Node.js, should have came across the term . Few may think that Buffer is only for library developers and its not in the scope of application developer. Here this blog is for you to provide an overview about the Buffer and its usage. Buffer objects are used to represent the binary data, which is used for data transmission in Node.js. Usage of Buffer is supported in Streams, File system and other Node.js internal API's. To interact with operating system (OS) using Node.js File API, the interactions were happens as a binary data which OS generally understand. In Node.js, Buffer Common usage Buffer Object Listing out some the common usage of Buffer object Streams API File System API Crypto API Http/Https API Character Encoding (base64, utf8, utf16 and other supported encoding) Image Processing Can I convert binary data (Buffer) as a String ? To convert Buffer as a String, Buffer uses for the conversion. Default character encoding is , which also supports options for utf16le, latin1 and others. character encoding utf8 In simple words, Once the buffer is processed to String it is encoded to the human readable string format. Hands on with Buffer To create a new buffer instance require the buffer global object and create instance using to decode the buffer use . Following snippet illustrates the examples for creating Buffer instance with different character encoding and with decoding. Buffer.from() Buffer.toString() buffer = ( ).Buffer; encBuffDefaultUtf8 = buffer.from( ); .log(encBuffDefaultUtf8); decBuffDefaultUtf8 = encBuffDefaultUtf8.toString() .log(decBuffDefaultUtf8); encBuffLatin = Buffer.from( , ); .log(encBuffLatin) decBuffLatin = encBuffLatin.toString( ); .log(decBuffLatin) const require 'buffer' // Encoding : Creates a Buffer containing default utf8 string let "hello world" console // Output: <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64> // Decoding : Covert a Buffer to utf8 string. let console // Output: hello world // Encoding : Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74]. const 'tést' 'latin1' console // <Buffer 74 e9 73 74> // Decoding : Covert a Buffer to Latin-1 string. const 'latin1' console // tést The usage of Buffer in returns the Buffer object chunk (partial data) on each event and its stored into an Array. Once the stream ends Buffer object is concatenated using and then parsed back to JSON https/https API Buffer.concat() https = ( ); https.get( , { : }, (res) => { data = []; res.on( , (chunk) => { isBuffer = Buffer.isBuffer(chunk); .log( , chunk); bufferChunk = isBuffer ? chunk : Buffer.from(chunk) data.push(bufferChunk); }) res.on( , () => { result = Buffer.concat(data) result = .parse(result); }) } ) const require 'https' "https://jsonplaceholder.typicode.com/users" rejectUnauthorized false let // Response stream 'data' // Check the type of chunk is Buffer, if not create as a buffer object const console `Is Buffer : - Chunk :` ${isBuffer} let // On end of the response, concatnate the Buffer and parse it to JSON object result 'end' let JSON // console.log("Result :", result); Buffer Performance Benchmark Consider the scenario, which you want to convert an Array as a String, users prefers to use but using is more faster. Array.toString() Buffer.toString() Benchmark = ( ); suite = Benchmark.Suite; input = [ , , , , , , , , , ]; suite.add( , { Buffer.from(input).toString() }) .add( , { input.toString() }) .on( , { .log( (event.target)); }) .on( , { .log( + .filter( ).map( )); }) .run({ : }); const require 'benchmark' var new let 28929 53068 96487 73074 8615 13068 86607 60890 44297 57022 'Buffer.toString' ( ) function 'Array#toString' ( ) function // add listeners 'cycle' ( ) function event console String 'complete' ( ) function console 'Fastest is ' this 'fastest' 'name' // run async 'async' true Benchmark Result The usage of Buffer is wrapped into most of the Node.js core module and most of the popular libraries. In order to get hands on in it try implementing it whenever you found a right usecase For better understanding check out this blog Buffer in Node.js