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()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。