The NodeJs docs imply there are no asynchronous system APIs that it could use to do file system operations and so asynchronous behavior is spoofed using a thread pool. I find it hard to believe that modern operating systems do not provide asynchronous system APIs for file system operations. Is that true? How can that possibly be the case?
Asynchronous system APIs are used by Node.js whenever possible, but where they do not exist, libuv's threadpool is used to create asynchronous node APIs based on synchronous system APIs. Node.js APIs that use the threadpool are:
all fs APIs, other than the file watcher APIs and those that are explicitly synchronous
Looks like they might be working on it: Is there really no asynchronous block I/O on Linux?
Interface is kernel backed and DOESN'T use a userspace thread pool
So maybe it not available for linux. So maybe it's just easier to use a threadpool until that functionality is available across all NodeJS platforms. I guess I should have done more research. Just seems odd for the docs not to say they use Asynchronous disk IO when available and a threadpool otherwise...