buf.buffer


  • <ArrayBuffer> 创建此 Buffer 对象所基于的基础 ArrayBuffer 对象。

    ¥<ArrayBuffer> The underlying ArrayBuffer object based on which this Buffer object is created.

不保证此 ArrayBuffer 与原始 Buffer 完全对应。有关详细信息,请参阅 buf.byteOffset 上的说明。

¥This ArrayBuffer is not guaranteed to correspond exactly to the original Buffer. See the notes on buf.byteOffset for details.

import { Buffer } from 'node:buffer';

const arrayBuffer = new ArrayBuffer(16);
const buffer = Buffer.from(arrayBuffer);

console.log(buffer.buffer === arrayBuffer);
// Prints: trueconst { Buffer } = require('node:buffer');

const arrayBuffer = new ArrayBuffer(16);
const buffer = Buffer.from(arrayBuffer);

console.log(buffer.buffer === arrayBuffer);
// Prints: true