Skip to content

Common Module

npm versionDownloadsInstall sizenpmBuild Status

A unified API to read directory or zip.

Support both nodejs and browser.

You can do read operations for zip or directory in same API:

ts
import { openFileSystem } from "@xmcl/system";

let filePath = "/path/to/dir/"
const fs = await openFileSystem(filePath);
fs.readFile("a.txt"); // read /path/to/dir/a.txt

let zipPath = "/path/to/file.zip"
const fs = await openFileSystem(zipPath);
fs.readFile("a.txt"); // read a.txt in the file.zip!

🧾 Classes

🏭 Functions

openFileSystem

ts
openFileSystem(basePath: string | Uint8Array): Promise<FileSystem>

Parameters

  • basePath: string | Uint8Array

Return Type

  • Promise<FileSystem>

Defined in: packages/system/index.ts:10

resolveFileSystem

ts
resolveFileSystem(base: string | Uint8Array | FileSystem): Promise<FileSystem>

Parameters

  • base: string | Uint8Array | FileSystem

Return Type

  • Promise<FileSystem>

Defined in: packages/system/index.ts:34