From b26a0670d61bb66ce406858c6305945b12d300f1 Mon Sep 17 00:00:00 2001 From: rafapaezbas Date: Fri, 27 Mar 2026 20:40:40 +0100 Subject: [PATCH 1/2] fix read empty files --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index 0876e4f7..898806d6 100644 --- a/index.js +++ b/index.js @@ -546,6 +546,11 @@ module.exports = class Hyperdrive extends ReadyResource { return cb(null) } + if (node.value.blob.byteLength === 0) { + stream.push(null) + return cb(null) + } + rs = self.blobs.createReadStream(node.value.blob, opts) rs.on('data', function (data) { From 099092bcf49e05b4000af376c915c31f3da969b0 Mon Sep 17 00:00:00 2001 From: rafapaezbas Date: Fri, 27 Mar 2026 21:16:07 +0100 Subject: [PATCH 2/2] tweak --- index.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/index.js b/index.js index 898806d6..94af115d 100644 --- a/index.js +++ b/index.js @@ -541,12 +541,7 @@ module.exports = class Hyperdrive extends ReadyResource { if (!node) return cb(new Error('Blob does not exist')) if (self.closing) return cb(new Error('Closed')) - if (!node.value.blob) { - stream.push(null) - return cb(null) - } - - if (node.value.blob.byteLength === 0) { + if (!node.value.blob || node.value.blob.byteLength === 0) { stream.push(null) return cb(null) }