Virtual FileSystem fixed - (Needs unit testing)!

This commit is contained in:
2026-11-09 05:10:44 +01:00
parent 832fc6c759
commit dd804f6f14
6 changed files with 307 additions and 346 deletions
+4 -2
View File
@@ -1,5 +1,7 @@
import type { Node } from "@core/filesystem/node";
import type { IDataStore, IMetaStore } from "@core/filesystem/vdisk";
import type { Blob } from "node:buffer";
import { Readable } from "node:stream";
export class MemMetaStore implements IMetaStore {
private _data: Map<number, Node | null> = new Map();
@@ -33,11 +35,11 @@ export class MemDataStore implements IDataStore {
return new Uint8Array(buff);
}
public stream(uuid: string): ReadableStream {
public stream(uuid: string): Readable {
const blob = this._data.get(uuid);
if (!blob) throw new Error("Content missing - " + uuid);
return blob.stream();
return Readable.from(blob.stream());
}
public put(uuid: string, blob: Blob): Promise<void> {