Skip to content

Commit 356e62c

Browse files
authored
fix: do not download all blocks when listing dir (#261)
* fix: do not fetch each item in directories * chore: remove unused extended: false * fix: createOfflineHelia fixture passes through types * chore: remove comma dangle * Update packages/verified-fetch/src/plugins/plugin-handle-dag-pb.ts * Update packages/verified-fetch/src/utils/walk-path.ts
1 parent fa2b23a commit 356e62c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

packages/verified-fetch/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
"@helia/interface": "^5.3.1",
171171
"@helia/ipns": "^8.2.2",
172172
"@helia/routers": "^3.1.1",
173-
"@helia/unixfs": "^5.0.2",
173+
"@helia/unixfs": "^5.1.0",
174174
"@ipld/car": "^5.4.2",
175175
"@ipld/dag-cbor": "^9.2.3",
176176
"@ipld/dag-json": "^10.2.4",
@@ -187,7 +187,7 @@
187187
"helia": "^5.4.1",
188188
"interface-blockstore": "^5.3.1",
189189
"interface-datastore": "^8.3.1",
190-
"ipfs-unixfs-exporter": "^13.6.2",
190+
"ipfs-unixfs-exporter": "^13.7.2",
191191
"ipns": "^10.0.2",
192192
"it-map": "^3.1.3",
193193
"it-pipe": "^3.0.1",
@@ -211,7 +211,7 @@
211211
"browser-readablestream-to-it": "^2.0.9",
212212
"datastore-core": "^10.0.2",
213213
"helia": "^5.4.1",
214-
"ipfs-unixfs-importer": "^15.3.2",
214+
"ipfs-unixfs-importer": "^15.4.0",
215215
"it-all": "^3.0.8",
216216
"it-last": "^3.0.8",
217217
"it-to-buffer": "^4.0.9",

packages/verified-fetch/src/plugins/plugin-handle-dag-pb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export class DagPbPlugin extends BasePlugin {
111111
context.modified++
112112
this.log.trace('attempting to get directory entries because index.html was not found')
113113
try {
114-
for await (const dirItem of fs.ls(dirCid, { signal: options?.signal, onProgress: options?.onProgress })) {
114+
for await (const dirItem of fs.ls(dirCid, { signal: options?.signal, onProgress: options?.onProgress, extended: false })) {
115115
context.directoryEntries.push(dirItem)
116116
}
117117
// dir-index-html plugin or dir-index-json (future idea?) plugin should handle this

packages/verified-fetch/src/utils/dir-index-html.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export const dirIndexHtml = (dir: UnixFSEntry, items: UnixFSEntry[], { gatewayUR
165165
},
166166
listing: items.map((item) => {
167167
return {
168-
size: item.size.toString(),
168+
size: item.size?.toString() ?? '?',
169169
name: item.name,
170170
path: getItemPath(item),
171171
hash: item.cid.toString(),

0 commit comments

Comments
 (0)