Skip to content

Commit

Permalink
Stream large blobs out of fs cache
Browse files Browse the repository at this point in the history
  • Loading branch information
lettertwo committed Nov 3, 2021
1 parent 5734312 commit da0a359
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/cache/src/LMDBCache.js
Expand Up @@ -58,9 +58,9 @@ export class LMDBCache implements Cache {
}

getStream(key: string): Readable {
return blobToStream(
this.store.get(key) ?? this.fs.readFileSync(path.join(this.dir, key)),
);
let buf = this.store.get(key);
if (buf != null) return blobToStream(buf);
return this.fs.createReadStream(path.join(this.dir, key));
}

async setStream(key: string, stream: Readable): Promise<void> {
Expand Down

0 comments on commit da0a359

Please sign in to comment.