Skip to main content

Module constants

Module constants 

Source
Expand description

The platform’s errno, signal and filesystem constants.

Every value comes from libc, so it is the number THIS build’s platform really uses. That matters: EADDRINUSE is 48 on macOS and 98 on Linux, SIGUSR1 is 30 and 10, SIGSTOP is 17 and 19. The signal table used to be a hardcoded list of macOS numbers, so os.constants.signals.SIGUSR1 was wrong on every Linux host and errno was missing entirely.

These feed os.constants, fs.constants and the legacy flat require('constants'), which is the union of all three.

Functions§

crypto
crypto.constants — OpenSSL’s own defines, which are the same numbers everywhere, plus the two padding constants libraries actually pass.
dlopen
os.constants.dlopen.
errno
(name, value) for every errno node exposes. A name absent on this platform is simply not listed, exactly as node’s own table is platform-shaped.
flat
The legacy flat require('constants'): the union of the dlopen, errno, signal, fs and crypto tables, in the order node lists them. A name defined by more than one table keeps the FIRST definition, as node’s does.
flat_lookup
One member of the flat table, for a require('constants').NAME read.
fs
(name, value) for fs.constants — open flags, access modes, file-type bits, permission bits and the copyfile flags.
object
A {name: value} object from a constant table.
priority
os.constants.priority — libuv’s own scale, not a platform one.
signals
(name, number) for every signal node exposes.