change the buffer to stream
This commit is contained in:
parent
b93c840ee2
commit
631314dea8
5 changed files with 134 additions and 24 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue