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

Function tryCreateBuffer

lib/fs.js:446–459  ·  view source on GitHub ↗
(size, fd, isUserFd)

Source from the content-addressed store, hash-verified

444}
445
446function tryCreateBuffer(size, fd, isUserFd) {
447 let threw = true;
448 let buffer;
449 try {
450 if (size > kIoMaxLength) {
451 throw new ERR_FS_FILE_TOO_LARGE(size);
452 }
453 buffer = Buffer.allocUnsafe(size);
454 threw = false;
455 } finally {
456 if (threw && !isUserFd) fs.closeSync(fd);
457 }
458 return buffer;
459}
460
461function tryGetReadFileBuffer(options, size, fd, isUserFd) {
462 let threw = true;

Callers 2

readFileSyncFunction · 0.85

Calls 1

closeSyncMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…