Available Modules
Lifo includes compatibility shims for 15 core Node.js modules:fs/fs/promises- Filesystem operations backed by VFSpath- Path manipulation (POSIX-compliant)os- Operating system utilitiesprocess- Process information and environmentevents- EventEmitter implementationbuffer- Buffer class for binary datautil- Utility functions (promisify, format, inspect)http/https- Virtual HTTP server via port registrychild_process- Spawn shell commandsstream- Readable, Writable, Transform streamsurl- URL parsing and manipulationtimers- setTimeout, setInterval, setImmediatecrypto- Cryptographic functions (Web Crypto API)zlib- Compression/decompression (gzip, deflate)string_decoder- String decoding for character encodingsquerystring- Query string parsingassert- Assertion testing
Running Node.js Code
Using the node Command
The easiest way to run Node.js code is with the built-in node command:
Module Resolution
The Node compatibility layer uses a customrequire() implementation that maps module names to Lifo’s shims:
Filesystem Module (fs)
The fs module is backed by Lifo’s VFS and provides both sync and async APIs:
Synchronous API
Promises API
Process Module
Theprocess module provides Node.js process information:
Path Module
Thepath module provides POSIX path utilities:
Events Module
Theevents module provides the EventEmitter class:
Buffer Module
Thebuffer module provides the Buffer class for binary data:
Child Process Module
Thechild_process module allows spawning shell commands:
HTTP Module
Thehttp module provides a virtual HTTP server using Lifo’s port registry: