Each OS has its own set of (from the lowest to the highest level):
- system calls like
fork
. - core utilities like
sed
. - common user applications like
vim
orNotepad
.
Directly executing one of those (e.g. calling sed
) won't usually work on every
OS.
Most Node.js API core modules abstract this (mostly through
libuv). For example, the
child_process
methods are
executing OS-specific system calls under the hood.
Some projects abstract OS-specific core utilities like:
MinGW
for gcc on Windows.msys
for Bash on Windows. Shipped with Git for Windows.shelljs
node-windows
Other projects provide with cross-platform features like copy/pasting, such as
clipboard-cli
.
Finally, some lower-level tools attempt to bring cross-platform compatibility by emulating or translating system calls:
- Wine: to run Windows API calls on Linux, Mac, BSD and Solaris.
- Cygwin: to run POSIX on Windows.
- WSL: to run the Linux command line on Windows (ELF binary execution, system calls, filesystem, Bash, core utilities, common applications).
Do not rely on OS system calls or core utilities without using an abstraction layer.