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

Function readFileAfterStat

lib/fs.js:355–377  ·  view source on GitHub ↗
(err, stats)

Source from the content-addressed store, hash-verified

353}
354
355function readFileAfterStat(err, stats) {
356 const context = this.context;
357
358 if (err)
359 return context.close(err);
360
361 // TODO(BridgeAR): Check if allocating a smaller chunk is better performance
362 // wise, similar to the promise based version (less peak memory and chunked
363 // stringify operations vs multiple C++/JS boundary crossings).
364 const size = context.size = isFileType(stats, S_IFREG) ? stats[8] : 0;
365
366 if (size > kIoMaxLength) {
367 err = new ERR_FS_FILE_TOO_LARGE(size);
368 return context.close(err);
369 }
370
371 try {
372 context.prepare();
373 } catch (err) {
374 return context.close(err);
375 }
376 context.read();
377}
378
379function checkAborted(signal, callback) {
380 if (signal?.aborted) {

Callers

nothing calls this directly

Calls 4

isFileTypeFunction · 0.85
closeMethod · 0.65
prepareMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…