boot()

The boot() function creates a new jiki container. It sets up the virtual filesystem, kernel, and shell.

Signature

import { boot } from "@run0/jiki";

const container = await boot(options?: BootOptions);

Options

OptionTypeDefaultDescription
cwdstring"/"Initial working directory
envRecord<string, string>{}Environment variables
snapshotUint8ArrayundefinedRestore from a previously saved snapshot
pluginsJikiPlugin[][]Plugins to register on the container
persistencePersistenceAdapterundefinedPersistence adapter for surviving page refreshes

Return value

Returns a Promise<Container> that resolves when the container is ready.

Example

import { boot } from "@run0/jiki";

const container = await boot({
  cwd: "/app",
  env: { NODE_ENV: "development" },
});

await container.fs.writeFile("/app/index.js", 'console.log("ready")');
await container.shell.execute("node index.js");