feat: Enhance Anisette API with WASM file handling and provisioning improvements

This commit is contained in:
2026-02-28 14:19:32 +08:00
parent d05cc41660
commit d75671596c
10 changed files with 110 additions and 99 deletions

View File

@@ -100,6 +100,22 @@ export class WasmBridge {
}
}
/**
* Read a file from the WASM virtual filesystem.
*/
readVirtualFile(filePath: string): Uint8Array {
const pathPtr = this.allocCString(filePath);
try {
const result = this.m._anisette_fs_read_file(pathPtr) as number;
this.check(result, `anisette_fs_read_file(${filePath})`);
} finally {
this.free(pathPtr);
}
const ptr = this.m._anisette_fs_read_ptr() as number;
const len = this.m._anisette_fs_read_len() as number;
return this.readBytes(ptr, len);
}
/**
* Write a file into the WASM virtual filesystem.
*/