Node.js module

buffer

The 'node:buffer' module provides a way to handle raw binary data directly in memory. Buffers are instances of the Buffer class, which is a fixed-length sequence of bytes.

The module includes methods to create, read, write, concatenate, and compare buffers. It is fundamental for I/O operations, such as reading files, handling network streams, and interfacing with C++ addons.

Fully supported in Bun

Fully implemented.

Functions 6

  • buffer.atob()

    MDN Reference

  • buffer.btoa()

    MDN Reference

  • buffer.isAscii()

    This function returns true if input contains only valid ASCII-encoded data, including the case in which input is empty.

  • buffer.isUtf8()

    This function returns true if input contains only valid UTF-8-encoded data, including the case in which input is empty.

  • buffer.resolveObjectURL()

    Resolves a 'blob:nodedata:...' an associated Blob object registered using a prior call to URL.createObjectURL().

  • buffer.transcode()

    Re-encodes the given Buffer or Uint8Array instance from one character encoding to another.

Classes 2

  • class buffer.Blob

    A Blob encapsulates immutable, raw data that can be safely shared across multiple worker threads.

  • class buffer.File

    A File provides information about files.

Interfaces 3

Types 3

Variables 5