4 ms·
Hm. Confused by Node.js async fs operations in this context. Does it just not actually work asynchronously behind the scenes?
by iameli 6y ago
Hm. Confused by Node.js async fs operations in this context. Does it just not actually work asynchronously behind the scenes?
- dmm 6y agoI haven't looked at Node's implementation in a few years but local i/o and was done with a thread pool to make the sync operations async. Lookup the libuv threadpool for more details.
- satori99 6y agoNode.js uses libuv for async file operations -- And libuv has its own internal thread pool to make file ops appear fully async to a node program. From the libuv docs [0]: Unlike network I/O, there are no platform-specific file I/O primitives libuv could rely on, so the current approach is to run blocking file I/O operations in a thread pool. For a thorough explanation of the cross-platform file I/O landscape, checkout this post [1]. [0] http://docs.libuv.org/en/v1.x/design.html#file-i-o http://docs.libuv.org/en/v1.x/design.html#file-i-o [1] https://blog.libtorrent.org/2012/10/asynchronous-disk-io/ https://blog.libtorrent.org/2012/10/asynchronous-disk-io/
- deleted 6y ago[deleted]