From 93e01f7dbc923920b32092344b507919bfcae125 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Thu, 13 Apr 2023 14:14:39 +0200 Subject: [PATCH] no prefetching when wait is false --- lib/streams.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/streams.js b/lib/streams.js index 6baccdc..d662b39 100644 --- a/lib/streams.js +++ b/lib/streams.js @@ -92,7 +92,7 @@ class BlobReadStream extends Readable { this.id = id this.core = core.session({ wait: opts.wait, timeout: opts.timeout }) - this._prefetch = opts.prefetch + this._prefetch = opts.wait === false ? noPrefetch : opts.prefetch this._lastPrefetch = null if (!this._prefetch) { const prefetcher = new SparsePrefetcher(opts) @@ -174,3 +174,7 @@ module.exports = { } function noop () {} + +function noPrefetch () { + return null +}