@utoo/web 0.0.1 → 1.0.0

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.
@@ -1,14 +1,22 @@
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;
15
+ toJSON(): {
16
+ name: string;
17
+ type: DirEntryType;
18
+ };
19
+ toString(): string;
12
20
  __destroy_into_raw(): number | undefined;
13
21
  __wbg_ptr: number | undefined;
14
22
  free(): void;
@@ -29,53 +37,103 @@ export class DirEntry {
29
37
  */
30
38
  get type(): DirEntryType;
31
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
+ }
32
48
  export class Project {
33
49
  /**
34
50
  * @param {string} cwd
51
+ * @param {string} thread_url
35
52
  */
36
- constructor(cwd: string);
53
+ constructor(cwd: string, thread_url: string);
37
54
  __destroy_into_raw(): number;
38
55
  __wbg_ptr: number;
39
56
  free(): void;
40
57
  /**
41
- * @returns {string}
58
+ * @param {string} path
59
+ * @returns {Promise<void>}
42
60
  */
43
- get cwd(): string;
61
+ createDir(path: string): Promise<void>;
44
62
  /**
45
- * @param {string} package_lock
63
+ * @param {string} path
64
+ * @param {boolean} recursive
46
65
  * @returns {Promise<void>}
47
66
  */
48
- install(package_lock: string): Promise<void>;
67
+ removeDir(path: string, recursive: boolean): Promise<void>;
49
68
  /**
69
+ * @param {string} path
50
70
  * @returns {Promise<void>}
51
71
  */
52
- build(): Promise<void>;
72
+ removeFile(path: string): Promise<void>;
53
73
  /**
54
74
  * @param {string} path
55
- * @returns {Promise<string>}
75
+ * @param {string} content
76
+ * @returns {Promise<void>}
56
77
  */
57
- readFile(path: string): Promise<string>;
78
+ writeString(path: string, content: string): Promise<void>;
58
79
  /**
59
80
  * @param {string} path
60
- * @param {string} content
61
81
  * @returns {Promise<void>}
62
82
  */
63
- writeFile(path: string, content: string): Promise<void>;
83
+ createDirAll(path: string): Promise<void>;
64
84
  /**
65
85
  * @param {string} path
66
- * @returns {Promise<DirEntry[]>}
86
+ * @returns {Promise<string>}
67
87
  */
68
- readDir(path: string): Promise<DirEntry[]>;
88
+ readToString(path: string): Promise<string>;
89
+ /**
90
+ * @returns {string}
91
+ */
92
+ get cwd(): string;
93
+ /**
94
+ * Create a tar.gz archive and return bytes (no file I/O)
95
+ * This is useful for main thread execution without OPFS access
96
+ * @param {any} files
97
+ * @returns {Uint8Array}
98
+ */
99
+ gzip(files: any): Uint8Array;
69
100
  /**
70
101
  * @param {string} path
71
- * @returns {Promise<void>}
102
+ * @returns {Promise<Uint8Array>}
72
103
  */
73
- createDir(path: string): Promise<void>;
104
+ read(path: string): Promise<Uint8Array>;
105
+ /**
106
+ * @returns {Promise<any>}
107
+ */
108
+ build(): Promise<any>;
74
109
  /**
75
110
  * @param {string} path
111
+ * @param {Uint8Array} content
76
112
  * @returns {Promise<void>}
77
113
  */
78
- createDirAll(path: string): Promise<void>;
114
+ write(path: string, content: Uint8Array): Promise<void>;
115
+ /**
116
+ * @param {string} package_lock
117
+ * @param {number | null} [max_concurrent_downloads]
118
+ * @returns {Promise<void>}
119
+ */
120
+ install(package_lock: string, max_concurrent_downloads?: number | null): Promise<void>;
121
+ /**
122
+ * Calculate MD5 hash of byte content
123
+ * @param {Uint8Array} content
124
+ * @returns {string}
125
+ */
126
+ sigMd5(content: Uint8Array): string;
127
+ /**
128
+ * @param {string} path
129
+ * @returns {Promise<Metadata>}
130
+ */
131
+ metadata(path: string): Promise<Metadata>;
132
+ /**
133
+ * @param {string} path
134
+ * @returns {Promise<DirEntry[]>}
135
+ */
136
+ readDir(path: string): Promise<DirEntry[]>;
79
137
  /**
80
138
  * @param {string} src
81
139
  * @param {string} dst
@@ -84,5 +142,5 @@ export class Project {
84
142
  copyFile(src: string, dst: string): Promise<void>;
85
143
  }
86
144
  export default __wbg_init;
87
- export function initSync(module: any): any;
88
- declare function __wbg_init(module_or_path: any): Promise<any>;
145
+ export function initSync(module: any, memory: any): any;
146
+ declare function __wbg_init(module_or_path: any, memory: any): Promise<any>;