@utoo/web 0.0.1-alpha.2 → 0.0.1-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ import { ProjectEndpoint } from "./type";
2
+ export declare class ForkedProject implements ProjectEndpoint {
3
+ private endpoint;
4
+ constructor(port: MessagePort);
5
+ install(packageLock: string): Promise<void>;
6
+ build(): Promise<void>;
7
+ readFile(path: string, encoding?: "utf8"): Promise<any>;
8
+ writeFile(path: string, content: string | Uint8Array, encoding?: "utf8"): Promise<void>;
9
+ copyFile(src: string, dst: string): Promise<void>;
10
+ readdir(path: string, options?: {
11
+ recursive?: boolean;
12
+ }): Promise<import("./type").Dirent[]>;
13
+ mkdir(path: string, options?: {
14
+ recursive?: boolean;
15
+ }): Promise<void>;
16
+ rm(path: string, options?: {
17
+ recursive?: boolean;
18
+ }): Promise<void>;
19
+ rmdir(path: string, options?: {
20
+ recursive?: boolean;
21
+ }): Promise<void>;
22
+ }
@@ -0,0 +1,34 @@
1
+ import * as comlink from "comlink";
2
+ export class ForkedProject {
3
+ constructor(port) {
4
+ var _a;
5
+ (_a = this.endpoint) !== null && _a !== void 0 ? _a : (this.endpoint = comlink.wrap(port));
6
+ }
7
+ async install(packageLock) {
8
+ return await this.endpoint.install(packageLock);
9
+ }
10
+ async build() {
11
+ return await this.endpoint.build();
12
+ }
13
+ async readFile(path, encoding) {
14
+ return (await this.endpoint.readFile(path, encoding));
15
+ }
16
+ async writeFile(path, content, encoding) {
17
+ return await this.endpoint.writeFile(path, content, encoding);
18
+ }
19
+ async copyFile(src, dst) {
20
+ return await this.endpoint.copyFile(src, dst);
21
+ }
22
+ async readdir(path, options) {
23
+ return await this.endpoint.readdir(path, options);
24
+ }
25
+ async mkdir(path, options) {
26
+ return await this.endpoint.mkdir(path, options);
27
+ }
28
+ async rm(path, options) {
29
+ return await this.endpoint.rm(path, options);
30
+ }
31
+ async rmdir(path, options) {
32
+ return await this.endpoint.rmdir(path, options);
33
+ }
34
+ }
package/esm/index.d.ts CHANGED
@@ -1,17 +1,2 @@
1
- import { ProjectEndpoint, DirEntry } from "./type";
2
- export declare class Project implements ProjectEndpoint {
3
- #private;
4
- private cwd;
5
- private remote;
6
- constructor(cwd: string);
7
- install(packageLock: string): Promise<void>;
8
- build(): Promise<void>;
9
- readFile(path: string): Promise<string>;
10
- writeFile(path: string, content: string): Promise<void>;
11
- copyFile(src: string, dst: string): Promise<void>;
12
- readDir(path: string): Promise<DirEntry[]>;
13
- createDir(path: string): Promise<void>;
14
- createDirAll(path: string): Promise<void>;
15
- static fork(port1: MessagePort, port2: MessagePort): ProjectEndpoint;
16
- }
1
+ export { Project } from "./project";
17
2
  export * from "./type";
package/esm/index.js CHANGED
@@ -1,105 +1,2 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7
- if (kind === "m") throw new TypeError("Private method is not writable");
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
- };
12
- var _Project_tunnel;
13
- import * as comlink from "comlink";
14
- import { Fork, HandShake } from "./message";
15
- let ProjectWorker;
16
- const ConnectedPorts = new Set();
17
- export class Project {
18
- constructor(cwd) {
19
- var _a, _b;
20
- _Project_tunnel.set(this, void 0);
21
- this.cwd = cwd;
22
- const { port1, port2 } = new MessageChannel();
23
- (_a = this.remote) !== null && _a !== void 0 ? _a : (this.remote = comlink.wrap(port1));
24
- if (!ProjectWorker) {
25
- ProjectWorker = new Worker(new URL("./worker", import.meta.url));
26
- self.addEventListener("message", (e) => {
27
- const port = e.ports[0];
28
- if (e.data === Fork && !ConnectedPorts.has(port)) {
29
- ProjectWorker.postMessage(HandShake, [port]);
30
- }
31
- });
32
- }
33
- ProjectWorker.postMessage(HandShake, [port2]);
34
- __classPrivateFieldSet(this, _Project_tunnel, (_b = __classPrivateFieldGet(this, _Project_tunnel, "f")) !== null && _b !== void 0 ? _b : this.remote.mount(this.cwd), "f");
35
- }
36
- async install(packageLock) {
37
- await __classPrivateFieldGet(this, _Project_tunnel, "f");
38
- return await this.remote.install(packageLock);
39
- }
40
- async build() {
41
- await __classPrivateFieldGet(this, _Project_tunnel, "f");
42
- return await this.remote.build();
43
- }
44
- async readFile(path) {
45
- await __classPrivateFieldGet(this, _Project_tunnel, "f");
46
- return await this.remote.readFile(path);
47
- }
48
- async writeFile(path, content) {
49
- await __classPrivateFieldGet(this, _Project_tunnel, "f");
50
- return await this.remote.writeFile(path, content);
51
- }
52
- async copyFile(src, dst) {
53
- await __classPrivateFieldGet(this, _Project_tunnel, "f");
54
- return await this.remote.copyFile(src, dst);
55
- }
56
- async readDir(path) {
57
- await __classPrivateFieldGet(this, _Project_tunnel, "f");
58
- return await this.remote.readDir(path);
59
- }
60
- async createDir(path) {
61
- await __classPrivateFieldGet(this, _Project_tunnel, "f");
62
- return await this.remote.createDir(path);
63
- }
64
- async createDirAll(path) {
65
- await __classPrivateFieldGet(this, _Project_tunnel, "f");
66
- return await this.remote.createDirAll(path);
67
- }
68
- // This should be called from different worker
69
- static fork(port1, port2) {
70
- self.postMessage(Fork, [port2]);
71
- return new ForkedProject(port1);
72
- }
73
- }
74
- _Project_tunnel = new WeakMap();
75
- class ForkedProject {
76
- constructor(port) {
77
- var _a;
78
- (_a = this.endpoint) !== null && _a !== void 0 ? _a : (this.endpoint = comlink.wrap(port));
79
- }
80
- async install(packageLock) {
81
- return await this.endpoint.install(packageLock);
82
- }
83
- async build() {
84
- return await this.endpoint.build();
85
- }
86
- async readFile(path) {
87
- return await this.endpoint.readFile(path);
88
- }
89
- async writeFile(path, content) {
90
- return await this.endpoint.writeFile(path, content);
91
- }
92
- async copyFile(src, dst) {
93
- return await this.endpoint.copyFile(src, dst);
94
- }
95
- async readDir(path) {
96
- return await this.endpoint.readDir(path);
97
- }
98
- async createDir(path) {
99
- return await this.endpoint.createDir(path);
100
- }
101
- async createDirAll(path) {
102
- return await this.endpoint.createDirAll(path);
103
- }
104
- }
1
+ export { Project } from "./project";
105
2
  export * from "./type";
@@ -0,0 +1 @@
1
+ export declare function installServiceWorker(url: string, scope: string): Promise<void>;
@@ -0,0 +1,36 @@
1
+ import { ServiceWorkerHandShake } from "./message";
2
+ export async function installServiceWorker(url, scope) {
3
+ const registration = await navigator.serviceWorker.register(url, {
4
+ scope: "/",
5
+ });
6
+ return new Promise((resolve) => {
7
+ function sendMessage(sw) {
8
+ sw.postMessage({
9
+ [ServiceWorkerHandShake]: true,
10
+ scope,
11
+ });
12
+ resolve();
13
+ }
14
+ function listenForActivation(sw) {
15
+ sw.addEventListener("statechange", () => {
16
+ if (sw.state === "activated") {
17
+ sendMessage(sw);
18
+ }
19
+ });
20
+ }
21
+ function checkSWState(registration) {
22
+ if (registration.active) {
23
+ sendMessage(registration.active);
24
+ }
25
+ else if (registration.installing) {
26
+ listenForActivation(registration.installing);
27
+ }
28
+ registration.addEventListener("updatefound", () => {
29
+ if (registration.installing) {
30
+ listenForActivation(registration.installing);
31
+ }
32
+ });
33
+ }
34
+ checkSWState(registration);
35
+ });
36
+ }
package/esm/message.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export declare const HandShake = "__handshake__";
2
+ export declare const ServiceWorkerHandShake = "__service_worker_handshake__";
2
3
  export declare const Fork = "__fork__";
package/esm/message.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export const HandShake = "__handshake__";
2
+ export const ServiceWorkerHandShake = "__service_worker_handshake__";
2
3
  export const Fork = "__fork__";
@@ -0,0 +1,28 @@
1
+ import { Dirent, ProjectEndpoint, ProjectOptions } from "./type";
2
+ export declare class Project implements ProjectEndpoint {
3
+ #private;
4
+ private serviceWorkerOptions?;
5
+ private remote;
6
+ constructor(options: ProjectOptions);
7
+ private connectWorker;
8
+ installServiceWorker(): Promise<void>;
9
+ mount(): Promise<void>;
10
+ install(packageLock: string): Promise<void>;
11
+ build(): Promise<void>;
12
+ readFile(path: string, encoding?: "utf8"): Promise<any>;
13
+ writeFile(path: string, content: string | Uint8Array, encoding?: "utf8"): Promise<void>;
14
+ copyFile(src: string, dst: string): Promise<void>;
15
+ readdir(path: string, options?: {
16
+ recursive?: boolean;
17
+ }): Promise<Dirent[]>;
18
+ mkdir(path: string, options?: {
19
+ recursive?: boolean;
20
+ }): Promise<void>;
21
+ rm(path: string, options?: {
22
+ recursive?: boolean;
23
+ }): Promise<void>;
24
+ rmdir(path: string, options?: {
25
+ recursive?: boolean;
26
+ }): Promise<void>;
27
+ static fork(channel: MessageChannel, eventSource?: Client | DedicatedWorkerGlobalScope): ProjectEndpoint;
28
+ }
package/esm/project.js ADDED
@@ -0,0 +1,108 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7
+ if (kind === "m") throw new TypeError("Private method is not writable");
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
+ };
12
+ var _Project_mount;
13
+ import * as comlink from "comlink";
14
+ import { ForkedProject } from "./forkedProject";
15
+ import { installServiceWorker } from "./installServiceWorker";
16
+ import { Fork, HandShake } from "./message";
17
+ import { Dirent, } from "./type";
18
+ let ProjectWorker;
19
+ const ConnectedPorts = new Set();
20
+ export class Project {
21
+ constructor(options) {
22
+ var _a, _b;
23
+ _Project_mount.set(this, void 0);
24
+ const { cwd, workerUrl, wasmUrl, threadWorkerUrl, serviceWorker } = options;
25
+ this.serviceWorkerOptions = serviceWorker;
26
+ const { port1, port2 } = new MessageChannel();
27
+ (_a = this.remote) !== null && _a !== void 0 ? _a : (this.remote = comlink.wrap(port1));
28
+ if (!ProjectWorker) {
29
+ ProjectWorker = workerUrl
30
+ ? new Worker(workerUrl)
31
+ : new Worker(new URL("./worker", import.meta.url));
32
+ window.addEventListener("message", (e) => {
33
+ this.connectWorker(e);
34
+ });
35
+ if (this.serviceWorkerOptions) {
36
+ navigator.serviceWorker.addEventListener("message", (e) => {
37
+ this.connectWorker(e);
38
+ });
39
+ }
40
+ }
41
+ ProjectWorker.postMessage(HandShake, [port2]);
42
+ __classPrivateFieldSet(this, _Project_mount, (_b = __classPrivateFieldGet(this, _Project_mount, "f")) !== null && _b !== void 0 ? _b : this.remote.mount({
43
+ cwd,
44
+ wasmUrl,
45
+ threadWorkerUrl,
46
+ }), "f");
47
+ }
48
+ connectWorker(e) {
49
+ const port = e.ports[0];
50
+ if (e.data === Fork && !ConnectedPorts.has(port)) {
51
+ ProjectWorker.postMessage(HandShake, [port]);
52
+ }
53
+ }
54
+ async installServiceWorker() {
55
+ if (this.serviceWorkerOptions) {
56
+ const { url, scope } = this.serviceWorkerOptions;
57
+ // Should add "Service-Worker-Allowed": "/" in page root response headers,
58
+ return await installServiceWorker(url, scope);
59
+ }
60
+ }
61
+ async mount() {
62
+ return await __classPrivateFieldGet(this, _Project_mount, "f");
63
+ }
64
+ async install(packageLock) {
65
+ await __classPrivateFieldGet(this, _Project_mount, "f");
66
+ return await this.remote.install(packageLock);
67
+ }
68
+ async build() {
69
+ await __classPrivateFieldGet(this, _Project_mount, "f");
70
+ return await this.remote.build();
71
+ }
72
+ async readFile(path, encoding) {
73
+ await __classPrivateFieldGet(this, _Project_mount, "f");
74
+ return (await this.remote.readFile(path, encoding));
75
+ }
76
+ async writeFile(path, content, encoding) {
77
+ await __classPrivateFieldGet(this, _Project_mount, "f");
78
+ return await this.remote.writeFile(path, content, encoding);
79
+ }
80
+ async copyFile(src, dst) {
81
+ await __classPrivateFieldGet(this, _Project_mount, "f");
82
+ return await this.remote.copyFile(src, dst);
83
+ }
84
+ async readdir(path, options) {
85
+ await __classPrivateFieldGet(this, _Project_mount, "f");
86
+ const dirEntry = (await this.remote.readdir(path, options));
87
+ return dirEntry.map((e) => new Dirent(e));
88
+ }
89
+ async mkdir(path, options) {
90
+ await __classPrivateFieldGet(this, _Project_mount, "f");
91
+ return await this.remote.mkdir(path, options);
92
+ }
93
+ async rm(path, options) {
94
+ await __classPrivateFieldGet(this, _Project_mount, "f");
95
+ return await this.remote.rm(path, options);
96
+ }
97
+ async rmdir(path, options) {
98
+ await __classPrivateFieldGet(this, _Project_mount, "f");
99
+ return await this.remote.rmdir(path, options);
100
+ }
101
+ static fork(channel, eventSource) {
102
+ (eventSource || self).postMessage(Fork, {
103
+ transfer: [channel.port2],
104
+ });
105
+ return new ForkedProject(channel.port1);
106
+ }
107
+ }
108
+ _Project_mount = new WeakMap();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,56 @@
1
+ import { Project } from ".";
2
+ import { ServiceWorkerHandShake } from "./message";
3
+ let _resolve;
4
+ let _promise = new Promise((resolve) => {
5
+ _resolve = resolve;
6
+ });
7
+ let _projectEndpoint;
8
+ let _serviceWorkerScope;
9
+ self.addEventListener("message", (event) => {
10
+ if (event.data && event.data[ServiceWorkerHandShake] === true) {
11
+ _serviceWorkerScope = event.data.scope;
12
+ _projectEndpoint = Project.fork(new MessageChannel(), event.source);
13
+ _resolve();
14
+ }
15
+ });
16
+ self.addEventListener("fetch", async (event) => {
17
+ const { url, referrer } = event.request;
18
+ if (new URL(url).pathname.startsWith(_serviceWorkerScope) ||
19
+ (referrer && new URL(referrer).pathname.startsWith(_serviceWorkerScope))) {
20
+ await _promise;
21
+ const projectPath = "." + new URL(url).pathname.replace(_serviceWorkerScope, "");
22
+ event.respondWith(readFileFromProject(projectPath));
23
+ }
24
+ else {
25
+ event.respondWith(fetch(event.request));
26
+ }
27
+ });
28
+ async function readFileFromProject(projectPath) {
29
+ try {
30
+ const content = await _projectEndpoint.readFile(projectPath);
31
+ let mimeType = "application/octet-stream";
32
+ if (projectPath.endsWith(".js")) {
33
+ mimeType = "application/javascript";
34
+ }
35
+ else if (projectPath.endsWith(".css")) {
36
+ mimeType = "text/css";
37
+ }
38
+ else if (projectPath.endsWith(".html")) {
39
+ mimeType = "text/html";
40
+ }
41
+ else if (projectPath.endsWith(".json")) {
42
+ mimeType = "application/json";
43
+ }
44
+ return new Response(content, {
45
+ headers: {
46
+ "Content-Type": mimeType,
47
+ ...(mimeType === "text/html"
48
+ ? { "Cross-Origin-Embedder-Policy": "require-corp" }
49
+ : {}),
50
+ },
51
+ });
52
+ }
53
+ catch (e) {
54
+ return new Response("Not Found", { status: 404 });
55
+ }
56
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import initWasm from "./utoo";
2
+ // this is for wasm_thread to spawn new worker thread.
3
+ // see: https://github.com/utooland/wasm_thread/blob/94438ff771ee0a6a55d79e49a655707970acb615/src/wasm32/js/web_worker.js#L10
4
+ self.wasm_bindgen = initWasm;
package/esm/type.d.ts CHANGED
@@ -1,15 +1,43 @@
1
- import type { DirEntryType } from "./utoo";
2
- export interface DirEntry {
1
+ import { DirEntryType } from "./utoo";
2
+ export interface RawDirent {
3
3
  name: string;
4
4
  type: DirEntryType;
5
5
  }
6
+ export declare class Dirent {
7
+ private rawDirent;
8
+ name: string;
9
+ constructor(rawDirent: RawDirent);
10
+ isDirectory(): boolean;
11
+ isFile(): boolean;
12
+ }
6
13
  export interface ProjectEndpoint {
7
14
  install: (packageLock: string) => Promise<void>;
8
15
  build: () => Promise<void>;
9
- readFile(path: string): Promise<string>;
10
- writeFile(path: string, content: string): Promise<void>;
11
- readDir(path: string): Promise<DirEntry[]>;
12
- createDir(path: string): Promise<void>;
13
- createDirAll(path: string): Promise<void>;
16
+ readFile(path: string): Promise<Uint8Array>;
17
+ readFile(path: string, encoding?: "utf8"): Promise<string>;
18
+ writeFile(path: string, content: string | Uint8Array, encoding?: "utf8"): Promise<void>;
19
+ readdir(path: string, options?: {
20
+ recursive?: boolean;
21
+ }): Promise<Dirent[]>;
22
+ mkdir(path: string, options?: {
23
+ recursive?: boolean;
24
+ }): Promise<void>;
25
+ rm(path: string, options?: {
26
+ recursive?: boolean;
27
+ }): Promise<void>;
28
+ rmdir(path: string, options?: {
29
+ recursive?: boolean;
30
+ }): Promise<void>;
14
31
  copyFile(src: string, dst: string): Promise<void>;
15
32
  }
33
+ export interface ProjectOptions {
34
+ cwd: string;
35
+ workerUrl?: string;
36
+ threadWorkerUrl: string;
37
+ wasmUrl?: string;
38
+ serviceWorker?: ServiceWorkerOptions;
39
+ }
40
+ export interface ServiceWorkerOptions {
41
+ url: string;
42
+ scope: string;
43
+ }
package/esm/type.js CHANGED
@@ -1 +1,12 @@
1
- export {};
1
+ export class Dirent {
2
+ constructor(rawDirent) {
3
+ this.rawDirent = rawDirent;
4
+ this.name = this.rawDirent.name;
5
+ }
6
+ isDirectory() {
7
+ return this.rawDirent.type === "directory";
8
+ }
9
+ isFile() {
10
+ return this.rawDirent.type === "file";
11
+ }
12
+ }
@@ -1,12 +1,15 @@
1
+ export function init_pack(): void;
2
+ /**
3
+ * Entry point for web workers
4
+ * @param {number} ptr
5
+ */
6
+ export function wasm_thread_entry_point(ptr: number): void;
1
7
  export class CreateSyncAccessHandleOptions {
2
8
  static __wrap(ptr: any): any;
3
9
  __destroy_into_raw(): number | undefined;
4
10
  __wbg_ptr: number | undefined;
5
11
  free(): void;
6
12
  }
7
- /**
8
- * Directory entry with name and type information
9
- */
10
13
  export class DirEntry {
11
14
  static __wrap(ptr: any): any;
12
15
  toJSON(): {
@@ -34,11 +37,20 @@ export class DirEntry {
34
37
  */
35
38
  get type(): DirEntryType;
36
39
  }
40
+ export class Metadata {
41
+ static __wrap(ptr: any): any;
42
+ toJSON(): {};
43
+ toString(): string;
44
+ __destroy_into_raw(): number | undefined;
45
+ __wbg_ptr: number | undefined;
46
+ free(): void;
47
+ }
37
48
  export class Project {
38
49
  /**
39
50
  * @param {string} cwd
51
+ * @param {string} thread_url
40
52
  */
41
- constructor(cwd: string);
53
+ constructor(cwd: string, thread_url: string);
42
54
  __destroy_into_raw(): number;
43
55
  __wbg_ptr: number;
44
56
  free(): void;
@@ -52,20 +64,31 @@ export class Project {
52
64
  */
53
65
  install(package_lock: string): Promise<void>;
54
66
  /**
55
- * @returns {Promise<void>}
67
+ * @returns {Promise<any>}
56
68
  */
57
- build(): Promise<void>;
69
+ build(): Promise<any>;
70
+ /**
71
+ * @param {string} path
72
+ * @returns {Promise<Uint8Array>}
73
+ */
74
+ read(path: string): Promise<Uint8Array>;
58
75
  /**
59
76
  * @param {string} path
60
77
  * @returns {Promise<string>}
61
78
  */
62
- readFile(path: string): Promise<string>;
79
+ readToString(path: string): Promise<string>;
80
+ /**
81
+ * @param {string} path
82
+ * @param {Uint8Array} content
83
+ * @returns {Promise<void>}
84
+ */
85
+ write(path: string, content: Uint8Array): Promise<void>;
63
86
  /**
64
87
  * @param {string} path
65
88
  * @param {string} content
66
89
  * @returns {Promise<void>}
67
90
  */
68
- writeFile(path: string, content: string): Promise<void>;
91
+ writeString(path: string, content: string): Promise<void>;
69
92
  /**
70
93
  * @param {string} path
71
94
  * @returns {Promise<DirEntry[]>}
@@ -87,7 +110,23 @@ export class Project {
87
110
  * @returns {Promise<void>}
88
111
  */
89
112
  copyFile(src: string, dst: string): Promise<void>;
113
+ /**
114
+ * @param {string} path
115
+ * @returns {Promise<void>}
116
+ */
117
+ removeFile(path: string): Promise<void>;
118
+ /**
119
+ * @param {string} path
120
+ * @param {boolean} recursive
121
+ * @returns {Promise<void>}
122
+ */
123
+ removeDir(path: string, recursive: boolean): Promise<void>;
124
+ /**
125
+ * @param {string} path
126
+ * @returns {Promise<Metadata>}
127
+ */
128
+ metadata(path: string): Promise<Metadata>;
90
129
  }
91
130
  export default __wbg_init;
92
- export function initSync(module: any): any;
93
- declare function __wbg_init(module_or_path: any): Promise<any>;
131
+ export function initSync(module: any, memory: any): any;
132
+ declare function __wbg_init(module_or_path: any, memory: any): Promise<any>;