Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ module.exports = class Hyperdrive extends ReadyResource {
dls.push(blobs.core.download({ start: b.blockOffset, length: b.blockLength }))
}

return new Download(this, undefined, { downloads: dls })
return new Download(this, null, { downloads: dls })
}

async downloadRange(dbRanges, blobRanges) {
Expand All @@ -448,7 +448,7 @@ module.exports = class Hyperdrive extends ReadyResource {
dls.push(blobs.core.download(range))
}

return new Download(this, undefined, { downloads: dls })
return new Download(this, null, { downloads: dls })
}

entries(range, opts) {
Expand Down Expand Up @@ -482,7 +482,7 @@ module.exports = class Hyperdrive extends ReadyResource {

// atm always recursive, but we should add some depth thing to it
list(folder, opts = {}) {
if (typeof folder === 'object') return this.list(undefined, folder)
if (typeof folder === 'object' && folder !== null) return this.list(undefined, folder)

folder = std(folder || '/', true)

Expand Down
12 changes: 7 additions & 5 deletions lib/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ module.exports = class Download extends ReadyResource {
// ignore
}

for await (const entry of drive.list(this.folder, this.options)) {
const b = entry.value.blob
if (!b) continue
if (this.folder !== null) {
for await (const entry of drive.list(this.folder, this.options)) {
const b = entry.value.blob
if (!b) continue

const blobs = await drive.getBlobs()
this.downloads.push(blobs.core.download({ start: b.blockOffset, length: b.blockLength }))
const blobs = await drive.getBlobs()
this.downloads.push(blobs.core.download({ start: b.blockOffset, length: b.blockLength }))
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ test('drive.downloadDiff(version, folder, [options])', async (t) => {
await mirror.drive.get('/parent/child/1')

t.is(filescount, filestelem.count)
t.is(blobscount, blobstelem.count)
t.is(blobscount + 1, blobstelem.count)

await drive.put('/parent/child/2', nil)

Expand Down