Interview Q&A / Node.js
Node.js interview questions
The event loop on the server, streams, modules and building APIs with Express.
Prefer rapid revision? Practise Node.js short interview answers →
- How do you convert a string to base64 and back in Node.js?
Use Buffer.from(text, "utf8").toString("base64") to encode and Buffer.from(b64, "base64").toString("utf8") to decode. Base64 is an encoding for transport, not encryption.
BeginnerQuick answer1 min read - What is a Buffer in Node.js and why does it exist?
A Buffer is a fixed-size chunk of raw memory holding bytes. Node uses it for binary data such as files, network packets and images, because JavaScript strings are meant for text, not raw bytes.
BeginnerQuick answer1 min read