Buffers
Buffers hold raw bytes. Convert from and to strings with encodings.
Example
const b = Buffer.from("héllo", "utf8");
console.log(b.length, b.toString("hex"), b.toString("base64"));
console.log(Buffer.from("aGk=", "base64").toString(), Buffer.alloc(3));Result
6 68c3a96c6c6f aMOpbGxv hi <Buffer 00 00 00>
Exercise
Bytes.
Buffer.("hi")
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.