(err, stats)
| 353 | } |
| 354 | |
| 355 | function 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 | |
| 379 | function checkAborted(signal, callback) { |
| 380 | if (signal?.aborted) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…