Node.js FAQ: Top Questions
18. What is the Buffer class in Node.js?
The Buffer class is a built-in Node.js class for handling raw binary data, used for operations like reading files, network communication, or encoding conversions.
-
Creation:
Buffer.from,Buffer.alloc,Buffer.allocUnsafe. -
Methods:
toString,write,slice,copy. -
Encodings:
utf8,hex,base64. - Use Case: Binary data manipulation, streams.
