Virtual FileSystem fixed - (Needs unit testing)!
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user