Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/wapython
Path: blob/main/core/wasi-js/src/filesystem.ts
1067 views
1
/* I copied this from unionfs */
2
3
import { Writable, Readable } from "stream";
4
import * as fs from "fs";
5
declare type FSMethods =
6
| "renameSync"
7
| "ftruncateSync"
8
| "truncateSync"
9
| "chownSync"
10
| "fchownSync"
11
| "lchownSync"
12
| "chmodSync"
13
| "fchmodSync"
14
| "lchmodSync"
15
| "statSync"
16
| "lstatSync"
17
| "fstatSync"
18
| "linkSync"
19
| "symlinkSync"
20
| "readlinkSync"
21
| "realpathSync"
22
| "unlinkSync"
23
| "rmdirSync"
24
| "mkdirSync"
25
| "readdirSync"
26
| "closeSync"
27
| "openSync"
28
| "utimesSync"
29
| "futimesSync"
30
| "fsyncSync"
31
| "writeSync"
32
| "readSync"
33
| "readFileSync"
34
| "writeFileSync"
35
| "appendFileSync"
36
| "existsSync"
37
| "accessSync"
38
| "createReadStream"
39
| "createWriteStream"
40
| "watchFile"
41
| "unwatchFile"
42
| "watch"
43
| "rename"
44
| "ftruncate"
45
| "truncate"
46
| "chown"
47
| "fchown"
48
| "lchown"
49
| "chmod"
50
| "fchmod"
51
| "lchmod"
52
| "stat"
53
| "lstat"
54
| "fstat"
55
| "link"
56
| "symlink"
57
| "readlink"
58
| "realpath"
59
| "unlink"
60
| "rmdir"
61
| "mkdir"
62
| "readdir"
63
| "close"
64
| "open"
65
| "utimes"
66
| "futimes"
67
| "fsync"
68
| "write"
69
| "read"
70
| "readFile"
71
| "writeFile"
72
| "appendFile"
73
| "exists"
74
| "access";
75
76
declare type FS = Pick<typeof fs, FSMethods | "promises">;
77
78
export default interface WASIFileSystem extends FS {
79
constants: { [name: string]: number };
80
WriteStream: typeof Writable | (new (...args: any[]) => Writable);
81
ReadStream: typeof Readable | (new (...args: any[]) => Readable);
82
waitUntilLoaded: () => Promise<void>; // after 'await fs.waitUntilLoaded()', then the filesystem is fully initialized.
83
}
84
85