buf.keys()
新增于: v1.1.0
-
返回:<Iterator>
\Returns: <Iterator>
创建并返回 迭代器 的 buf 键(索引)。
\Creates and returns an iterator of buf keys (indices).
import { Buffer } from 'node:buffer'; const buf = Buffer.from('buffer'); for (const key of buf.keys()) { console.log(key); } // Prints: // 0 // 1 // 2 // 3 // 4 // 5const { Buffer } = require('node:buffer'); const buf = Buffer.from('buffer'); for (const key of buf.keys()) { console.log(key); } // Prints: // 0 // 1 // 2 // 3 // 4 // 5