buf.buffer
- <ArrayBuffer> 创建此
Buffer
对象所基于的底层ArrayBuffer
对象。
不保证此 ArrayBuffer
与原始 Buffer
完全对应。
有关详细信息,请参阅 buf.byteOffset
上的说明。
import { Buffer } from 'node:buffer';
const arrayBuffer = new ArrayBuffer(16);
const buffer = Buffer.from(arrayBuffer);
console.log(buffer.buffer === arrayBuffer);
// 打印: true
const { Buffer } = require('node:buffer');
const arrayBuffer = new ArrayBuffer(16);
const buffer = Buffer.from(arrayBuffer);
console.log(buffer.buffer === arrayBuffer);
// 打印: true
- <ArrayBuffer> The underlying
ArrayBuffer
object based on which thisBuffer
object is created.
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: true
const { Buffer } = require('node:buffer');
const arrayBuffer = new ArrayBuffer(16);
const buffer = Buffer.from(arrayBuffer);
console.log(buffer.buffer === arrayBuffer);
// Prints: true