buf.entries()
添加於:v1.1.0
- 返回: <Iterator>
從 buf
的內容創建並返回 [index, byte]
對的 iterator。
import { Buffer } from 'node:buffer'; // Log the entire contents of a `Buffer`. const buf = Buffer.from('buffer'); for (const pair of buf.entries()) { console.log(pair); } // Prints: // [0, 98] // [1, 117] // [2, 102] // [3, 102] // [4, 101] // [5, 114]
const { Buffer } = require('node:buffer'); // Log the entire contents of a `Buffer`. const buf = Buffer.from('buffer'); for (const pair of buf.entries()) { console.log(pair); } // Prints: // [0, 98] // [1, 117] // [2, 102] // [3, 102] // [4, 101] // [5, 114]
相關用法
- Node.js Buffer buf.equals(otherBuffer)用法及代碼示例
- Node.js Buffer buf.writeBigUInt64BE(value[, offset])用法及代碼示例
- Node.js Buffer buf.toString([encoding[, start[, end]]])用法及代碼示例
- Node.js Buffer buf.writeDoubleLE(value[, offset])用法及代碼示例
- Node.js Buffer buf.writeBigInt64LE(value[, offset])用法及代碼示例
- Node.js Buffer buf.keys()用法及代碼示例
- Node.js Buffer buf.writeFloatLE(value[, offset])用法及代碼示例
- Node.js Buffer buf.indexOf(value[, byteOffset][, encoding])用法及代碼示例
- Node.js Buffer buf.readFloatLE([offset])用法及代碼示例
- Node.js Buffer buf.readInt32LE([offset])用法及代碼示例
- Node.js Buffer buf.writeInt8(value[, offset])用法及代碼示例
- Node.js Buffer buf.swap32()用法及代碼示例
- Node.js Buffer buf.writeInt32LE(value[, offset])用法及代碼示例
- Node.js Buffer buf.writeIntLE(value, offset, byteLength)用法及代碼示例
- Node.js Buffer buf.values()用法及代碼示例
- Node.js Buffer buf.writeDoubleBE(value[, offset])用法及代碼示例
- Node.js Buffer buf.length用法及代碼示例
- Node.js Buffer buf.byteOffset用法及代碼示例
- Node.js Buffer buf.readUInt32BE([offset])用法及代碼示例
- Node.js Buffer buf.readDoubleLE([offset])用法及代碼示例
- Node.js Buffer buf.writeFloatBE(value[, offset])用法及代碼示例
- Node.js Buffer buf.readBigUInt64LE([offset])用法及代碼示例
- Node.js Buffer buf.readUInt16BE([offset])用法及代碼示例
- Node.js Buffer buf.writeInt16BE(value[, offset])用法及代碼示例
- Node.js Buffer buf.swap64()用法及代碼示例
注:本文由純淨天空篩選整理自nodejs.org大神的英文原創作品 buf.entries()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。