Core ModulesLesson 29Free preview
Buffer Module
This lesson is part of Node.js · All levels
Summary
Buffer is a class for representing raw binary data in memory, such as the contents of an image file or network packet. JavaScript doesn't have a built-in binary type, so Buffer is the bridge. Buffers are fixed sized and can be converted to a string or array of bytes.
Key points
- Buffer represents binary data of fixed size in memory
- Buffer.from to make from string/array, Buffer.alloc to empty buffer
- General encoding: utf8, base64, hex
- Buffer length is calculated in bytes
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.