Interview Hub
Sign in

Q12: What is `Buffer` and why does Node have it?

MidNode.js 29

Answer

Buffer represents binary data (raw bytes). It exists because the web TypedArray ecosystem evolved differently; Node historically used Buffers for TCP, files, crypto. Prefer Buffer.from() / Uint8Array awareness; know that JSON.stringify on raw binary needs encoding (e.g. base64).

Having a tech or coding interview? Check 29 JavaScript & Node.js interview questions.

Source: Node.js — Buffer

EditorJavaScript · local only