@lifo-sh/core
v0.4.6
Published
Linux-like OS engine for JavaScript -- kernel, shell, VFS, and 60+ commands
Maintainers
Readme
@lifo-sh/core
Core engine for Lifo -- a Linux-like OS that runs natively in JavaScript. Provides the kernel, virtual filesystem, shell, and 60+ commands.
Works in both browser and Node.js environments.
Install
npm install @lifo-sh/coreQuick Start
Headless / Programmatic
import { Sandbox } from '@lifo-sh/core';
const sandbox = await Sandbox.create();
const result = await sandbox.commands.run('echo hello world');
console.log(result.stdout); // "hello world\n"
await sandbox.fs.writeFile('/tmp/greeting.txt', 'Hi there');
const content = await sandbox.fs.readFile('/tmp/greeting.txt');
console.log(content); // "Hi there"Browser with Terminal UI
import { Sandbox } from '@lifo-sh/core';
// Requires @lifo-sh/ui as an optional peer dependency
const sandbox = await Sandbox.create({
terminal: '#terminal-container',
persist: true,
});What's Included
- Kernel -- virtual filesystem (VFS), virtual
/procand/devproviders, IndexedDB persistence - Shell -- bash-like interpreter with pipes, redirects, globs, variables, job control, tab completion, history
- 60+ commands --
ls,grep,awk,sed,curl,node,tar,find, and more - Sandbox API -- high-level
commands.run()andfs.*for programmatic use - Node.js compat layer -- run JS files with
node script.jsusing shimmedfs,path,http, etc.
Packages
| Package | Description | |---|---| | @lifo-sh/core | Kernel, shell, commands, sandbox API | | @lifo-sh/ui | Terminal UI (xterm.js wrapper) | | lifo-sh | CLI -- run Lifo in your terminal |
Links
License
MIT
