Skip to main content

init

Function init 

Source
pub fn init(ctx: &Ctx<'_>) -> Result<()>
Expand description

Install fs as a global.

Node has no global fs. A host that wants one (a scripting surface where fs.readFileSync with no import is the expected ergonomics) opts in here; what it names is this module’s own surface — the same object an import of node:fs answers with, so the two cannot drift.

§Errors

Returns an error if the global cannot be defined.