Cloudflare 中文文档
Workers
Workers
编辑这个页面
跳转官方原文档
Set theme to dark (⇧+D)

Buffer

The Buffer API in Node.js is one of the most commonly used Node.js APIs for manipulating binary data. Every Buffer instance extends from the standard Uint8Array class, but adds a range of unique capabilities such as built-in base64 and hex encoding/decoding, byte-order manipulation, and encoding-aware substring searching.

A Buffer extends from Uint8Array. Therefore, it can be used in any Workers API that currently accepts Uint8Array, such as creating a new Response:

You can also use the Buffer API when interacting with streams:

Refer to the Node.js documentation for Buffer for more information.