Skip to main content

fs_object

Function fs_object 

Source
pub fn fs_object<'js>(ctx: &Ctx<'js>) -> Result<Object<'js>>
Expand description

The VM’s one fs namespace object.

Built once per context and remembered, because Node answers the same object for every spelling: require("fs") === require("node:fs"), and the global is that object too. Handing back a fresh one each time would make those comparisons false and give a caller who patched a method a copy nobody else sees.