MCPcopy Index your code
hub / github.com/nodejs/node / buildBuffer

Function buildBuffer

test/parallel/test-buffer-alloc.js:672–679  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

670}
671
672function buildBuffer(data) {
673 if (Array.isArray(data)) {
674 const buffer = Buffer.allocUnsafe(data.length);
675 data.forEach((v, k) => buffer[k] = v);
676 return buffer;
677 }
678 return null;
679}
680
681const x = buildBuffer([0x81, 0xa3, 0x66, 0x6f, 0x6f, 0xa3, 0x62, 0x61, 0x72]);
682

Callers 1

Calls 1

forEachMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…