NodeJS Special Variables
NodeJS has several file local variables: __dirname
, __filename
, _module
, and require
. Their semantics are more like macros instead of functions.
bs.node
exposes support for these.
RElet dirname: option(string) = [%bs.node __dirname];
let filename: option(string) = [%bs.node __filename];
let _module: option(Node.node_module) = [%bs.node _module];
let require: option(Node.node_require) = [%bs.node require];