CheerpX.Linux.create

Create a CheerpX application instance

namespace CheerpX {
class Linux {
static async create(options?: {
mounts?: MountPointConfiguration[];
networkInterface?: NetworkInterface;
}): Promise<CheerpX.Linux>;
}
}
interface MountPointConfiguration {
// Specifies the filesystem type
// 'ext2' for Linux ext2
// 'dir' for a hierarchical file system
// 'devs' for device files
// 'proc' for process info files.
type: "ext2" | "dir" | "devs" | "proc";
// First mount must be "/" (root)
path: string;
// Can be one of: overlayDevice / webDevice / dataDevice / idbDevice
dev: CheerpX.Device;
}
interface NetworkInterface {
authKey?: string;
controlUrl?: string;
loginUrlCb?: (url: string) => void;
stateUpdateCb?: (state: number) => void;
netmapUpdateCb?: (map: any) => void;
}

Parameters

  • options (object, optional) - Used to configure different settings of the CheerpX Linux environment. This object may include settings for mounts, network interfaces, and other features, structured as { option: "value" }.

Returns

CheerpX.Linux.create returns a Promise which is resolved once the CheerpX Linux environment is fully initialized and ready to use. The resolved value is a CheerpX.Linux instance that provides methods for interacting with the CheerpX environment.

Options

A description of each CheerpX.Linux.create option with brief examples are given below.

mounts

mounts?: MountPointConfiguration[];

This option configures the filesystems that will be available in the CheerpX environment. Each mount point configures a device and specifies where it should be accessible within the virtual filesystem.

Example:

const cx = await CheerpX.Linux.create({
mounts: [
{ type: "ext2", path: "/", dev: overlayDevice },
{ type: "dir", path: "/app", dev: webDevice },
],
});
Note
CheerpX supports a variety of backends, designed to provide access to HTTP resources, IndexedDB-base persistent storage and data from JavaScript. Complete Ext2 filesystems are also supported on top of block devices. For detailed information, including usage examples and full APIs, please refer to the Files and filesystems guide.

networkInterface

networkInterface?: NetworkInterface;

This option configures network settings, which allows CheerpX to communicate over networks.

Was this page helpful?
Suggest changes