Xianqiao Wang

Xianqiao Wang

Some records of life and study

  • Home

fs.readFile<Sync>过程

同步读取文件:
https://github.com/nodejs/node/blob/master/lib/fs.js#L372 (一次同步循环全部读取完,每次读取 1K)
https://github.com/nodejs/node/blob/master/lib/fs.js#L335
https://github.com/nodejs/node/blob/master/lib/fs.js#L504
https://github.com/nodejs/node/blob/master/src/node_file.cc#L1602

异步读取文件:
https://github.com/nodejs/node/blob/master/lib/fs.js#L287
https://github.com/nodejs/node/blob/master/lib/fs.js#L293
…
https://github.com/nodejs/node/blob/master/lib/fs.js#L276
https://github.com/nodejs/node/blob/master/lib/internal/fs/read_file_context.js#L84
https://github.com/nodejs/node/blob/master/src/node_file.cc#L418 (异步,Promise?)
https://github.com/nodejs/node/blob/master/lib/internal/fs/read_file_context.js#L88
https://github.com/nodejs/node/blob/master/src/node_file.cc#L1602 (一次读取 1k)
https://github.com/nodejs/node/blob/master/lib/internal/fs/read_file_context.js#L27


Published by Xianqiao Wang on July 26th, 2018

  • Nodejs
  • RSS

© 2025 Xianqiao's Site.

Design by Fabien Penso. Powered by Postach.io