change the buffer to stream

This commit is contained in:
Yasindu20 2026-01-22 12:25:21 +05:30
parent b93c840ee2
commit 631314dea8
5 changed files with 134 additions and 24 deletions

View file

@ -23,6 +23,16 @@ export class LocalStorageAdapter implements IStorageAdapter {
async delete(key: string): Promise<void> {
const fullPath = path.join(this.baseDir, key);
await fs.unlink(fullPath);
try {
await fs.unlink(fullPath);
} catch {
//ignore error if file does not exist
}
}
getStream(key: string): ReadableStream<Uint8Array> {
const fullPath = path.join(this.baseDir, key);
const file = Bun.file(fullPath);
return file.stream();
}
}