@fireproof/vendor 0.0.0-smoke
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +29 -0
- package/patched/@ipld/dag-json/.github/dependabot.yml +11 -0
- package/patched/@ipld/dag-json/.github/workflows/js-test-and-release.yml +28 -0
- package/patched/@ipld/dag-json/CHANGELOG.md +202 -0
- package/patched/@ipld/dag-json/LICENSE +4 -0
- package/patched/@ipld/dag-json/LICENSE-APACHE +5 -0
- package/patched/@ipld/dag-json/LICENSE-MIT +19 -0
- package/patched/@ipld/dag-json/README.md +58 -0
- package/patched/@ipld/dag-json/ipld-dag-json-10.2.3.tgz +0 -0
- package/patched/@ipld/dag-json/package.json +173 -0
- package/patched/@ipld/dag-json/src/index.js +291 -0
- package/patched/@ipld/dag-json/test/test-basics.spec.js +290 -0
- package/patched/@ipld/dag-json/test/ts-use/package.json +11 -0
- package/patched/@ipld/dag-json/test/ts-use/src/main.ts +54 -0
- package/patched/@ipld/dag-json/test/ts-use/tsconfig.json +9 -0
- package/patched/@ipld/dag-json/tsconfig.json +14 -0
- package/patched/cborg/.github/dependabot.yml +16 -0
- package/patched/cborg/.github/workflows/test-and-release.yml +52 -0
- package/patched/cborg/CHANGELOG.md +513 -0
- package/patched/cborg/LICENSE +13 -0
- package/patched/cborg/README.md +515 -0
- package/patched/cborg/bench/bench.js +117 -0
- package/patched/cborg/bench/json.js +124 -0
- package/patched/cborg/bench/package.json +8 -0
- package/patched/cborg/cborg-4.2.7.tgz +0 -0
- package/patched/cborg/cborg.js +31 -0
- package/patched/cborg/example-bytestrings.js +180 -0
- package/patched/cborg/example-json.js +6 -0
- package/patched/cborg/example.js +5 -0
- package/patched/cborg/interface.ts +56 -0
- package/patched/cborg/lib/0uint.js +227 -0
- package/patched/cborg/lib/1negint.js +111 -0
- package/patched/cborg/lib/2bytes.js +133 -0
- package/patched/cborg/lib/3string.js +90 -0
- package/patched/cborg/lib/4array.js +113 -0
- package/patched/cborg/lib/5map.js +113 -0
- package/patched/cborg/lib/6tag.js +80 -0
- package/patched/cborg/lib/7float.js +308 -0
- package/patched/cborg/lib/bin.js +189 -0
- package/patched/cborg/lib/bl.js +124 -0
- package/patched/cborg/lib/byte-utils.js +417 -0
- package/patched/cborg/lib/common.js +27 -0
- package/patched/cborg/lib/decode.js +209 -0
- package/patched/cborg/lib/diagnostic.js +156 -0
- package/patched/cborg/lib/diagnostic_test.js +117 -0
- package/patched/cborg/lib/encode.js +464 -0
- package/patched/cborg/lib/is.js +106 -0
- package/patched/cborg/lib/json/decode.js +462 -0
- package/patched/cborg/lib/json/encode.js +299 -0
- package/patched/cborg/lib/json/json.js +4 -0
- package/patched/cborg/lib/jump.js +209 -0
- package/patched/cborg/lib/length.js +61 -0
- package/patched/cborg/lib/token.js +76 -0
- package/patched/cborg/package.json +169 -0
- package/patched/cborg/pnpm-lock.yaml +6096 -0
- package/patched/cborg/taglib.js +73 -0
- package/patched/cborg/test/appendix_a.js +647 -0
- package/patched/cborg/test/common.js +18 -0
- package/patched/cborg/test/node-test-bin.js +402 -0
- package/patched/cborg/test/noop-bin-test.js +3 -0
- package/patched/cborg/test/test-0uint.js +103 -0
- package/patched/cborg/test/test-1negint.js +96 -0
- package/patched/cborg/test/test-2bytes.js +198 -0
- package/patched/cborg/test/test-3string.js +136 -0
- package/patched/cborg/test/test-4array.js +93 -0
- package/patched/cborg/test/test-5map.js +284 -0
- package/patched/cborg/test/test-6tag.js +85 -0
- package/patched/cborg/test/test-7float.js +131 -0
- package/patched/cborg/test/test-bl.js +37 -0
- package/patched/cborg/test/test-cbor-vectors.js +107 -0
- package/patched/cborg/test/test-decode-errors.js +65 -0
- package/patched/cborg/test/test-fuzz.js +42 -0
- package/patched/cborg/test/test-json.js +219 -0
- package/patched/cborg/test/test-length.js +65 -0
- package/patched/cborg/test/test-partial.js +111 -0
- package/patched/cborg/tsconfig.json +45 -0
- package/patched/cborg/types/cborg.d.ts +28 -0
- package/patched/cborg/types/cborg.d.ts.map +1 -0
- package/patched/cborg/types/example.d.ts +2 -0
- package/patched/cborg/types/example.d.ts.map +1 -0
- package/patched/cborg/types/interface.d.ts +47 -0
- package/patched/cborg/types/interface.d.ts.map +1 -0
- package/patched/cborg/types/lib/0uint.d.ts +100 -0
- package/patched/cborg/types/lib/0uint.d.ts.map +1 -0
- package/patched/cborg/types/lib/1negint.d.ts +58 -0
- package/patched/cborg/types/lib/1negint.d.ts.map +1 -0
- package/patched/cborg/types/lib/2bytes.d.ts +68 -0
- package/patched/cborg/types/lib/2bytes.d.ts.map +1 -0
- package/patched/cborg/types/lib/3string.d.ts +46 -0
- package/patched/cborg/types/lib/3string.d.ts.map +1 -0
- package/patched/cborg/types/lib/4array.d.ts +65 -0
- package/patched/cborg/types/lib/4array.d.ts.map +1 -0
- package/patched/cborg/types/lib/5map.d.ts +65 -0
- package/patched/cborg/types/lib/5map.d.ts.map +1 -0
- package/patched/cborg/types/lib/6tag.d.ts +61 -0
- package/patched/cborg/types/lib/6tag.d.ts.map +1 -0
- package/patched/cborg/types/lib/7float.d.ts +60 -0
- package/patched/cborg/types/lib/7float.d.ts.map +1 -0
- package/patched/cborg/types/lib/bin.d.ts +4 -0
- package/patched/cborg/types/lib/bin.d.ts.map +1 -0
- package/patched/cborg/types/lib/bl.d.ts +26 -0
- package/patched/cborg/types/lib/bl.d.ts.map +1 -0
- package/patched/cborg/types/lib/byte-utils.d.ts +53 -0
- package/patched/cborg/types/lib/byte-utils.d.ts.map +1 -0
- package/patched/cborg/types/lib/common.d.ts +10 -0
- package/patched/cborg/types/lib/common.d.ts.map +1 -0
- package/patched/cborg/types/lib/decode.d.ts +41 -0
- package/patched/cborg/types/lib/decode.d.ts.map +1 -0
- package/patched/cborg/types/lib/diagnostic.d.ts +12 -0
- package/patched/cborg/types/lib/diagnostic.d.ts.map +1 -0
- package/patched/cborg/types/lib/diagnostic_test.d.ts +2 -0
- package/patched/cborg/types/lib/diagnostic_test.d.ts.map +1 -0
- package/patched/cborg/types/lib/encode.d.ts +50 -0
- package/patched/cborg/types/lib/encode.d.ts.map +1 -0
- package/patched/cborg/types/lib/is.d.ts +6 -0
- package/patched/cborg/types/lib/is.d.ts.map +1 -0
- package/patched/cborg/types/lib/json/decode.d.ts +67 -0
- package/patched/cborg/types/lib/json/decode.d.ts.map +1 -0
- package/patched/cborg/types/lib/json/encode.d.ts +11 -0
- package/patched/cborg/types/lib/json/encode.d.ts.map +1 -0
- package/patched/cborg/types/lib/json/forward-cborg.d.ts +6 -0
- package/patched/cborg/types/lib/json/forward-cborg.d.ts.map +1 -0
- package/patched/cborg/types/lib/json/json.d.ts +6 -0
- package/patched/cborg/types/lib/json/json.d.ts.map +1 -0
- package/patched/cborg/types/lib/jump.d.ts +12 -0
- package/patched/cborg/types/lib/jump.d.ts.map +1 -0
- package/patched/cborg/types/lib/length.d.ts +27 -0
- package/patched/cborg/types/lib/length.d.ts.map +1 -0
- package/patched/cborg/types/lib/token.d.ts +59 -0
- package/patched/cborg/types/lib/token.d.ts.map +1 -0
- package/patched/cborg/types/taglib.d.ts +18 -0
- package/patched/cborg/types/taglib.d.ts.map +1 -0
- package/patched/cborg/types/tsconfig.tsbuildinfo +1 -0
- package/src/@ipld/car/car/LICENSE +4 -0
- package/src/@ipld/car/car/README.md +1078 -0
- package/src/@ipld/car/car/dist/index.min.js +5 -0
- package/src/@ipld/car/car/dist/src/api.d.ts +72 -0
- package/src/@ipld/car/car/dist/src/api.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/buffer-decoder.d.ts +67 -0
- package/src/@ipld/car/car/dist/src/buffer-decoder.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/buffer-reader-browser.d.ts +116 -0
- package/src/@ipld/car/car/dist/src/buffer-reader-browser.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/buffer-reader.d.ts +31 -0
- package/src/@ipld/car/car/dist/src/buffer-reader.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/buffer-writer.d.ts +86 -0
- package/src/@ipld/car/car/dist/src/buffer-writer.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/coding.d.ts +49 -0
- package/src/@ipld/car/car/dist/src/coding.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/decoder-common.d.ts +43 -0
- package/src/@ipld/car/car/dist/src/decoder-common.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/decoder.d.ts +87 -0
- package/src/@ipld/car/car/dist/src/decoder.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/encoder.d.ts +17 -0
- package/src/@ipld/car/car/dist/src/encoder.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/header-validator.d.ts +5 -0
- package/src/@ipld/car/car/dist/src/header-validator.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/index-browser.d.ts +10 -0
- package/src/@ipld/car/car/dist/src/index-browser.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/index.d.ts +11 -0
- package/src/@ipld/car/car/dist/src/index.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/indexed-reader-browser.d.ts +5 -0
- package/src/@ipld/car/car/dist/src/indexed-reader-browser.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/indexed-reader.d.ts +152 -0
- package/src/@ipld/car/car/dist/src/indexed-reader.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/indexer.d.ts +95 -0
- package/src/@ipld/car/car/dist/src/indexer.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/iterator-channel.d.ts +7 -0
- package/src/@ipld/car/car/dist/src/iterator-channel.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/iterator.d.ts +174 -0
- package/src/@ipld/car/car/dist/src/iterator.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/reader-browser.d.ts +151 -0
- package/src/@ipld/car/car/dist/src/reader-browser.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/reader.d.ts +35 -0
- package/src/@ipld/car/car/dist/src/reader.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/writer-browser.d.ts +155 -0
- package/src/@ipld/car/car/dist/src/writer-browser.d.ts.map +1 -0
- package/src/@ipld/car/car/dist/src/writer.d.ts +45 -0
- package/src/@ipld/car/car/dist/src/writer.d.ts.map +1 -0
- package/src/@ipld/car/car/node_modules/.bin/cborg +17 -0
- package/src/@ipld/car/car/package.json +235 -0
- package/src/@ipld/car/car/src/api.ts +90 -0
- package/src/@ipld/car/car/src/buffer-decoder.js +213 -0
- package/src/@ipld/car/car/src/buffer-reader-browser.js +144 -0
- package/src/@ipld/car/car/src/buffer-reader.js +51 -0
- package/src/@ipld/car/car/src/buffer-writer.js +286 -0
- package/src/@ipld/car/car/src/coding.ts +68 -0
- package/src/@ipld/car/car/src/decoder-common.js +82 -0
- package/src/@ipld/car/car/src/decoder.js +347 -0
- package/src/@ipld/car/car/src/encoder.js +76 -0
- package/src/@ipld/car/car/src/header-validator.js +214 -0
- package/src/@ipld/car/car/src/header.ipldsch +18 -0
- package/src/@ipld/car/car/src/index-browser.js +18 -0
- package/src/@ipld/car/car/src/index.js +21 -0
- package/src/@ipld/car/car/src/indexed-reader-browser.js +7 -0
- package/src/@ipld/car/car/src/indexed-reader.js +211 -0
- package/src/@ipld/car/car/src/indexer.js +130 -0
- package/src/@ipld/car/car/src/iterator-channel.js +91 -0
- package/src/@ipld/car/car/src/iterator.js +267 -0
- package/src/@ipld/car/car/src/reader-browser.js +194 -0
- package/src/@ipld/car/car/src/reader.js +56 -0
- package/src/@ipld/car/car/src/writer-browser.js +250 -0
- package/src/@ipld/car/car/src/writer.js +84 -0
- package/src/@ipld/dag-cbor/dag-cbor/LICENSE +4 -0
- package/src/@ipld/dag-cbor/dag-cbor/README.md +80 -0
- package/src/@ipld/dag-cbor/dag-cbor/dist/index.min.js +3 -0
- package/src/@ipld/dag-cbor/dag-cbor/dist/src/index.d.ts +67 -0
- package/src/@ipld/dag-cbor/dag-cbor/dist/src/index.d.ts.map +1 -0
- package/src/@ipld/dag-cbor/dag-cbor/node_modules/.bin/cborg +17 -0
- package/src/@ipld/dag-cbor/dag-cbor/package.json +171 -0
- package/src/@ipld/dag-cbor/dag-cbor/src/index.js +147 -0
- package/src/@ipld/dag-json/dag-json/LICENSE +4 -0
- package/src/@ipld/dag-json/dag-json/README.md +58 -0
- package/src/@ipld/dag-json/dag-json/dist/index.min.js +3 -0
- package/src/@ipld/dag-json/dag-json/dist/src/index.d.ts +12 -0
- package/src/@ipld/dag-json/dag-json/dist/src/index.d.ts.map +1 -0
- package/src/@ipld/dag-json/dag-json/node_modules/.bin/cborg +17 -0
- package/src/@ipld/dag-json/dag-json/package.json +173 -0
- package/src/@ipld/dag-json/dag-json/src/index.js +291 -0
- package/src/@web3-storage/pail/pail/LICENSE.md +232 -0
- package/src/@web3-storage/pail/pail/README.md +84 -0
- package/src/@web3-storage/pail/pail/cli.js +218 -0
- package/src/@web3-storage/pail/pail/dist/src/api.d.ts +59 -0
- package/src/@web3-storage/pail/pail/dist/src/api.d.ts.map +1 -0
- package/src/@web3-storage/pail/pail/dist/src/batch/api.d.ts +31 -0
- package/src/@web3-storage/pail/pail/dist/src/batch/api.d.ts.map +1 -0
- package/src/@web3-storage/pail/pail/dist/src/batch/index.d.ts +75 -0
- package/src/@web3-storage/pail/pail/dist/src/batch/index.d.ts.map +1 -0
- package/src/@web3-storage/pail/pail/dist/src/batch/shard.d.ts +3 -0
- package/src/@web3-storage/pail/pail/dist/src/batch/shard.d.ts.map +1 -0
- package/src/@web3-storage/pail/pail/dist/src/block.d.ts +35 -0
- package/src/@web3-storage/pail/pail/dist/src/block.d.ts.map +1 -0
- package/src/@web3-storage/pail/pail/dist/src/clock/api.d.ts +10 -0
- package/src/@web3-storage/pail/pail/dist/src/clock/api.d.ts.map +1 -0
- package/src/@web3-storage/pail/pail/dist/src/clock/index.d.ts +48 -0
- package/src/@web3-storage/pail/pail/dist/src/clock/index.d.ts.map +1 -0
- package/src/@web3-storage/pail/pail/dist/src/crdt/api.d.ts +26 -0
- package/src/@web3-storage/pail/pail/dist/src/crdt/api.d.ts.map +1 -0
- package/src/@web3-storage/pail/pail/dist/src/crdt/batch/api.d.ts +11 -0
- package/src/@web3-storage/pail/pail/dist/src/crdt/batch/api.d.ts.map +1 -0
- package/src/@web3-storage/pail/pail/dist/src/crdt/batch/index.d.ts +5 -0
- package/src/@web3-storage/pail/pail/dist/src/crdt/batch/index.d.ts.map +1 -0
- package/src/@web3-storage/pail/pail/dist/src/crdt/index.d.ts +9 -0
- package/src/@web3-storage/pail/pail/dist/src/crdt/index.d.ts.map +1 -0
- package/src/@web3-storage/pail/pail/dist/src/diff.d.ts +13 -0
- package/src/@web3-storage/pail/pail/dist/src/diff.d.ts.map +1 -0
- package/src/@web3-storage/pail/pail/dist/src/index.d.ts +10 -0
- package/src/@web3-storage/pail/pail/dist/src/index.d.ts.map +1 -0
- package/src/@web3-storage/pail/pail/dist/src/merge.d.ts +5 -0
- package/src/@web3-storage/pail/pail/dist/src/merge.d.ts.map +1 -0
- package/src/@web3-storage/pail/pail/dist/src/shard.d.ts +43 -0
- package/src/@web3-storage/pail/pail/dist/src/shard.d.ts.map +1 -0
- package/src/@web3-storage/pail/pail/dist/tsconfig.tsbuildinfo +1 -0
- package/src/@web3-storage/pail/pail/node_modules/.bin/pail +17 -0
- package/src/@web3-storage/pail/pail/package.json +173 -0
- package/src/@web3-storage/pail/pail/src/api.js +1 -0
- package/src/@web3-storage/pail/pail/src/api.ts +90 -0
- package/src/@web3-storage/pail/pail/src/batch/api.js +1 -0
- package/src/@web3-storage/pail/pail/src/batch/api.ts +59 -0
- package/src/@web3-storage/pail/pail/src/batch/index.js +258 -0
- package/src/@web3-storage/pail/pail/src/batch/shard.js +13 -0
- package/src/@web3-storage/pail/pail/src/block.js +75 -0
- package/src/@web3-storage/pail/pail/src/clock/api.js +1 -0
- package/src/@web3-storage/pail/pail/src/clock/api.ts +12 -0
- package/src/@web3-storage/pail/pail/src/clock/index.js +182 -0
- package/src/@web3-storage/pail/pail/src/crdt/api.js +1 -0
- package/src/@web3-storage/pail/pail/src/crdt/api.ts +33 -0
- package/src/@web3-storage/pail/pail/src/crdt/batch/api.js +1 -0
- package/src/@web3-storage/pail/pail/src/crdt/batch/api.ts +30 -0
- package/src/@web3-storage/pail/pail/src/crdt/batch/index.js +155 -0
- package/src/@web3-storage/pail/pail/src/crdt/index.js +354 -0
- package/src/@web3-storage/pail/pail/src/diff.js +151 -0
- package/src/@web3-storage/pail/pail/src/index.js +406 -0
- package/src/@web3-storage/pail/pail/src/merge.js +43 -0
- package/src/@web3-storage/pail/pail/src/shard.js +180 -0
- package/src/cborg/cborg/.github/dependabot.yml +16 -0
- package/src/cborg/cborg/.github/workflows/test-and-release.yml +52 -0
- package/src/cborg/cborg/CHANGELOG.md +513 -0
- package/src/cborg/cborg/LICENSE +13 -0
- package/src/cborg/cborg/README.md +515 -0
- package/src/cborg/cborg/bench/bench.js +117 -0
- package/src/cborg/cborg/bench/json.js +124 -0
- package/src/cborg/cborg/bench/package.json +8 -0
- package/src/cborg/cborg/cborg.js +31 -0
- package/src/cborg/cborg/example-bytestrings.js +180 -0
- package/src/cborg/cborg/example-json.js +6 -0
- package/src/cborg/cborg/example.js +5 -0
- package/src/cborg/cborg/interface.ts +56 -0
- package/src/cborg/cborg/lib/0uint.js +227 -0
- package/src/cborg/cborg/lib/1negint.js +111 -0
- package/src/cborg/cborg/lib/2bytes.js +133 -0
- package/src/cborg/cborg/lib/3string.js +90 -0
- package/src/cborg/cborg/lib/4array.js +113 -0
- package/src/cborg/cborg/lib/5map.js +113 -0
- package/src/cborg/cborg/lib/6tag.js +80 -0
- package/src/cborg/cborg/lib/7float.js +308 -0
- package/src/cborg/cborg/lib/bin.js +189 -0
- package/src/cborg/cborg/lib/bl.js +124 -0
- package/src/cborg/cborg/lib/byte-utils.js +417 -0
- package/src/cborg/cborg/lib/common.js +27 -0
- package/src/cborg/cborg/lib/decode.js +209 -0
- package/src/cborg/cborg/lib/diagnostic.js +156 -0
- package/src/cborg/cborg/lib/diagnostic_test.js +117 -0
- package/src/cborg/cborg/lib/encode.js +464 -0
- package/src/cborg/cborg/lib/is.js +106 -0
- package/src/cborg/cborg/lib/json/decode.js +462 -0
- package/src/cborg/cborg/lib/json/encode.js +299 -0
- package/src/cborg/cborg/lib/json/json.js +4 -0
- package/src/cborg/cborg/lib/jump.js +209 -0
- package/src/cborg/cborg/lib/length.js +61 -0
- package/src/cborg/cborg/lib/token.js +76 -0
- package/src/cborg/cborg/node_modules/.bin/cborg +17 -0
- package/src/cborg/cborg/package.json +168 -0
- package/src/cborg/cborg/taglib.js +73 -0
- package/src/cborg/cborg/test/appendix_a.js +647 -0
- package/src/cborg/cborg/test/common.js +18 -0
- package/src/cborg/cborg/test/node-test-bin.js +402 -0
- package/src/cborg/cborg/test/noop-bin-test.js +3 -0
- package/src/cborg/cborg/test/test-0uint.js +103 -0
- package/src/cborg/cborg/test/test-1negint.js +96 -0
- package/src/cborg/cborg/test/test-2bytes.js +198 -0
- package/src/cborg/cborg/test/test-3string.js +136 -0
- package/src/cborg/cborg/test/test-4array.js +93 -0
- package/src/cborg/cborg/test/test-5map.js +284 -0
- package/src/cborg/cborg/test/test-6tag.js +85 -0
- package/src/cborg/cborg/test/test-7float.js +131 -0
- package/src/cborg/cborg/test/test-bl.js +37 -0
- package/src/cborg/cborg/test/test-cbor-vectors.js +107 -0
- package/src/cborg/cborg/test/test-decode-errors.js +65 -0
- package/src/cborg/cborg/test/test-fuzz.js +42 -0
- package/src/cborg/cborg/test/test-json.js +219 -0
- package/src/cborg/cborg/test/test-length.js +65 -0
- package/src/cborg/cborg/test/test-partial.js +111 -0
- package/src/cborg/cborg/tsconfig.json +45 -0
- package/src/cborg/cborg/types/cborg.d.ts +28 -0
- package/src/cborg/cborg/types/cborg.d.ts.map +1 -0
- package/src/cborg/cborg/types/example.d.ts +2 -0
- package/src/cborg/cborg/types/example.d.ts.map +1 -0
- package/src/cborg/cborg/types/interface.d.ts +47 -0
- package/src/cborg/cborg/types/interface.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/0uint.d.ts +100 -0
- package/src/cborg/cborg/types/lib/0uint.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/1negint.d.ts +58 -0
- package/src/cborg/cborg/types/lib/1negint.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/2bytes.d.ts +68 -0
- package/src/cborg/cborg/types/lib/2bytes.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/3string.d.ts +46 -0
- package/src/cborg/cborg/types/lib/3string.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/4array.d.ts +65 -0
- package/src/cborg/cborg/types/lib/4array.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/5map.d.ts +65 -0
- package/src/cborg/cborg/types/lib/5map.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/6tag.d.ts +61 -0
- package/src/cborg/cborg/types/lib/6tag.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/7float.d.ts +60 -0
- package/src/cborg/cborg/types/lib/7float.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/bin.d.ts +4 -0
- package/src/cborg/cborg/types/lib/bin.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/bl.d.ts +26 -0
- package/src/cborg/cborg/types/lib/bl.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/byte-utils.d.ts +53 -0
- package/src/cborg/cborg/types/lib/byte-utils.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/common.d.ts +10 -0
- package/src/cborg/cborg/types/lib/common.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/decode.d.ts +41 -0
- package/src/cborg/cborg/types/lib/decode.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/diagnostic.d.ts +12 -0
- package/src/cborg/cborg/types/lib/diagnostic.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/diagnostic_test.d.ts +2 -0
- package/src/cborg/cborg/types/lib/diagnostic_test.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/encode.d.ts +50 -0
- package/src/cborg/cborg/types/lib/encode.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/is.d.ts +6 -0
- package/src/cborg/cborg/types/lib/is.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/json/decode.d.ts +67 -0
- package/src/cborg/cborg/types/lib/json/decode.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/json/encode.d.ts +11 -0
- package/src/cborg/cborg/types/lib/json/encode.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/json/forward-cborg.d.ts +6 -0
- package/src/cborg/cborg/types/lib/json/forward-cborg.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/json/json.d.ts +6 -0
- package/src/cborg/cborg/types/lib/json/json.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/jump.d.ts +12 -0
- package/src/cborg/cborg/types/lib/jump.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/length.d.ts +27 -0
- package/src/cborg/cborg/types/lib/length.d.ts.map +1 -0
- package/src/cborg/cborg/types/lib/token.d.ts +59 -0
- package/src/cborg/cborg/types/lib/token.d.ts.map +1 -0
- package/src/cborg/cborg/types/taglib.d.ts +18 -0
- package/src/cborg/cborg/types/taglib.d.ts.map +1 -0
- package/src/cborg/cborg/types/tsconfig.tsbuildinfo +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/LICENSE +4 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/README.md +105 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/index.min.js +3 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/errors.d.ts +57 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/errors.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/errors.js +73 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/errors.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/index.d.ts +355 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/index.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/index.js +197 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/index.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts +4 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js +9 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts +4 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js +9 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts +4 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/identity.js +38 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/identity.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts +4 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/index.js +30 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/index.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts +4 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/json.js +9 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/json.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts +4 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/raw.js +37 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/raw.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts +4 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js +29 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts +4 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js +153 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts +4 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js +59 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts +4 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js +25 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts +4 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js +104 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts +3 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js +20 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts +6 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js +116 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts +4 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js +57 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts +6 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js +30 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js.map +1 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/dist/typedoc-urls.json +58 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/package.json +180 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/errors.ts +87 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/index.ts +498 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/dag-cbor.ts +12 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/dag-json.ts +12 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/identity.ts +49 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/index.ts +35 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/json.ts +12 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/raw.ts +49 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/directory.ts +39 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.ts +198 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/hamt-sharded-directory.ts +76 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/raw.ts +37 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.ts +121 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/utils/extract-data-from-block.ts +24 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/utils/find-cid-in-shard.ts +149 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/utils/resolve-object-path.ts +62 -0
- package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/utils/validate-offset-and-length.ts +38 -0
package/src/ipfs-unixfs-exporter/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/directory.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import filter from 'it-filter'
|
|
2
|
+
import map from 'it-map'
|
|
3
|
+
import parallel from 'it-parallel'
|
|
4
|
+
import { pipe } from 'it-pipe'
|
|
5
|
+
import { CustomProgressEvent } from 'progress-events'
|
|
6
|
+
import type { ExporterOptions, ExportWalk, UnixfsV1DirectoryContent, UnixfsV1Resolver } from '../../../index.js'
|
|
7
|
+
|
|
8
|
+
const directoryContent: UnixfsV1Resolver = (cid, node, unixfs, path, resolve, depth, blockstore) => {
|
|
9
|
+
async function * yieldDirectoryContent (options: ExporterOptions = {}): UnixfsV1DirectoryContent {
|
|
10
|
+
const offset = options.offset ?? 0
|
|
11
|
+
const length = options.length ?? node.Links.length
|
|
12
|
+
const links = node.Links.slice(offset, length)
|
|
13
|
+
|
|
14
|
+
options.onProgress?.(new CustomProgressEvent<ExportWalk>('unixfs:exporter:walk:directory', {
|
|
15
|
+
cid
|
|
16
|
+
}))
|
|
17
|
+
|
|
18
|
+
yield * pipe(
|
|
19
|
+
links,
|
|
20
|
+
source => map(source, link => {
|
|
21
|
+
return async () => {
|
|
22
|
+
const linkName = link.Name ?? ''
|
|
23
|
+
const linkPath = `${path}/${linkName}`
|
|
24
|
+
const result = await resolve(link.Hash, linkName, linkPath, [], depth + 1, blockstore, options)
|
|
25
|
+
return result.entry
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
28
|
+
source => parallel(source, {
|
|
29
|
+
ordered: true,
|
|
30
|
+
concurrency: options.blockReadConcurrency
|
|
31
|
+
}),
|
|
32
|
+
source => filter(source, entry => entry != null)
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return yieldDirectoryContent
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default directoryContent
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import * as dagPb from '@ipld/dag-pb'
|
|
2
|
+
import { UnixFS } from 'ipfs-unixfs'
|
|
3
|
+
import map from 'it-map'
|
|
4
|
+
import parallel from 'it-parallel'
|
|
5
|
+
import { pipe } from 'it-pipe'
|
|
6
|
+
import { type Pushable, pushable } from 'it-pushable'
|
|
7
|
+
import * as raw from 'multiformats/codecs/raw'
|
|
8
|
+
import PQueue from 'p-queue'
|
|
9
|
+
import { CustomProgressEvent } from 'progress-events'
|
|
10
|
+
import { NotUnixFSError, OverReadError, UnderReadError } from '../../../errors.js'
|
|
11
|
+
import extractDataFromBlock from '../../../utils/extract-data-from-block.js'
|
|
12
|
+
import validateOffsetAndLength from '../../../utils/validate-offset-and-length.js'
|
|
13
|
+
import type { ExporterOptions, UnixfsV1FileContent, UnixfsV1Resolver, ReadableStorage, ExportProgress, ExportWalk } from '../../../index.js'
|
|
14
|
+
|
|
15
|
+
async function walkDAG (blockstore: ReadableStorage, node: dagPb.PBNode | Uint8Array, queue: Pushable<Uint8Array>, streamPosition: bigint, start: bigint, end: bigint, options: ExporterOptions): Promise<void> {
|
|
16
|
+
// a `raw` node
|
|
17
|
+
if (node instanceof Uint8Array) {
|
|
18
|
+
const buf = extractDataFromBlock(node, streamPosition, start, end)
|
|
19
|
+
|
|
20
|
+
queue.push(buf)
|
|
21
|
+
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (node.Data == null) {
|
|
26
|
+
throw new NotUnixFSError('no data in PBNode')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let file: UnixFS
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
file = UnixFS.unmarshal(node.Data)
|
|
33
|
+
} catch (err: any) {
|
|
34
|
+
throw new NotUnixFSError(err.message)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// might be a unixfs `raw` node or have data on intermediate nodes
|
|
38
|
+
if (file.data != null) {
|
|
39
|
+
const data = file.data
|
|
40
|
+
const buf = extractDataFromBlock(data, streamPosition, start, end)
|
|
41
|
+
|
|
42
|
+
queue.push(buf)
|
|
43
|
+
|
|
44
|
+
streamPosition += BigInt(buf.byteLength)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const childOps: Array<{ link: dagPb.PBLink, blockStart: bigint }> = []
|
|
48
|
+
|
|
49
|
+
if (node.Links.length !== file.blockSizes.length) {
|
|
50
|
+
throw new NotUnixFSError('Inconsistent block sizes and dag links')
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
for (let i = 0; i < node.Links.length; i++) {
|
|
54
|
+
const childLink = node.Links[i]
|
|
55
|
+
const childStart = streamPosition // inclusive
|
|
56
|
+
const childEnd = childStart + file.blockSizes[i] // exclusive
|
|
57
|
+
|
|
58
|
+
if ((start >= childStart && start < childEnd) || // child has offset byte
|
|
59
|
+
(end >= childStart && end <= childEnd) || // child has end byte
|
|
60
|
+
(start < childStart && end > childEnd)) { // child is between offset and end bytes
|
|
61
|
+
childOps.push({
|
|
62
|
+
link: childLink,
|
|
63
|
+
blockStart: streamPosition
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
streamPosition = childEnd
|
|
68
|
+
|
|
69
|
+
if (streamPosition > end) {
|
|
70
|
+
break
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
await pipe(
|
|
75
|
+
childOps,
|
|
76
|
+
(source) => map(source, (op) => {
|
|
77
|
+
return async () => {
|
|
78
|
+
const block = await blockstore.get(op.link.Hash, options)
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
...op,
|
|
82
|
+
block
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
(source) => parallel(source, {
|
|
87
|
+
ordered: true,
|
|
88
|
+
concurrency: options.blockReadConcurrency
|
|
89
|
+
}),
|
|
90
|
+
async (source) => {
|
|
91
|
+
for await (const { link, block, blockStart } of source) {
|
|
92
|
+
let child: dagPb.PBNode | Uint8Array
|
|
93
|
+
switch (link.Hash.code) {
|
|
94
|
+
case dagPb.code:
|
|
95
|
+
child = dagPb.decode(block)
|
|
96
|
+
break
|
|
97
|
+
case raw.code:
|
|
98
|
+
child = block
|
|
99
|
+
break
|
|
100
|
+
default:
|
|
101
|
+
queue.end(new NotUnixFSError(`Unsupported codec: ${link.Hash.code}`))
|
|
102
|
+
return
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// create a queue for this child - we use a queue instead of recursion
|
|
106
|
+
// to avoid overflowing the stack
|
|
107
|
+
const childQueue = new PQueue({
|
|
108
|
+
concurrency: 1
|
|
109
|
+
})
|
|
110
|
+
// if any of the child jobs error, end the read queue with the error
|
|
111
|
+
childQueue.on('error', error => {
|
|
112
|
+
queue.end(error)
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
// if the job rejects the 'error' event will be emitted on the child queue
|
|
116
|
+
void childQueue.add(async () => {
|
|
117
|
+
options.onProgress?.(new CustomProgressEvent<ExportWalk>('unixfs:exporter:walk:file', {
|
|
118
|
+
cid: link.Hash
|
|
119
|
+
}))
|
|
120
|
+
|
|
121
|
+
await walkDAG(blockstore, child, queue, blockStart, start, end, options)
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
// wait for this child to complete before moving on to the next
|
|
125
|
+
await childQueue.onIdle()
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
if (streamPosition >= end) {
|
|
131
|
+
queue.end()
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const fileContent: UnixfsV1Resolver = (cid, node, unixfs, path, resolve, depth, blockstore) => {
|
|
136
|
+
async function * yieldFileContent (options: ExporterOptions = {}): UnixfsV1FileContent {
|
|
137
|
+
const fileSize = unixfs.fileSize()
|
|
138
|
+
|
|
139
|
+
if (fileSize === undefined) {
|
|
140
|
+
throw new Error('File was a directory')
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const {
|
|
144
|
+
start,
|
|
145
|
+
end
|
|
146
|
+
} = validateOffsetAndLength(fileSize, options.offset, options.length)
|
|
147
|
+
|
|
148
|
+
if (end === 0n) {
|
|
149
|
+
return
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
let read = 0n
|
|
153
|
+
const wanted = end - start
|
|
154
|
+
const queue = pushable()
|
|
155
|
+
|
|
156
|
+
options.onProgress?.(new CustomProgressEvent<ExportWalk>('unixfs:exporter:walk:file', {
|
|
157
|
+
cid
|
|
158
|
+
}))
|
|
159
|
+
|
|
160
|
+
void walkDAG(blockstore, node, queue, 0n, start, end, options)
|
|
161
|
+
.catch(err => {
|
|
162
|
+
queue.end(err)
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
for await (const buf of queue) {
|
|
166
|
+
if (buf == null) {
|
|
167
|
+
continue
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
read += BigInt(buf.byteLength)
|
|
171
|
+
|
|
172
|
+
if (read > wanted) {
|
|
173
|
+
queue.end()
|
|
174
|
+
throw new OverReadError('Read too many bytes - the file size reported by the UnixFS data in the root node may be incorrect')
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (read === wanted) {
|
|
178
|
+
queue.end()
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
options.onProgress?.(new CustomProgressEvent<ExportProgress>('unixfs:exporter:progress:unixfs:file', {
|
|
182
|
+
bytesRead: read,
|
|
183
|
+
totalBytes: wanted,
|
|
184
|
+
fileSize
|
|
185
|
+
}))
|
|
186
|
+
|
|
187
|
+
yield buf
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (read < wanted) {
|
|
191
|
+
throw new UnderReadError('Traversed entire DAG but did not read enough bytes')
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return yieldFileContent
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export default fileContent
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { decode, type PBNode } from '@ipld/dag-pb'
|
|
2
|
+
import { UnixFS } from 'ipfs-unixfs'
|
|
3
|
+
import map from 'it-map'
|
|
4
|
+
import parallel from 'it-parallel'
|
|
5
|
+
import { pipe } from 'it-pipe'
|
|
6
|
+
import { CustomProgressEvent } from 'progress-events'
|
|
7
|
+
import { NotUnixFSError } from '../../../errors.js'
|
|
8
|
+
import type { ExporterOptions, Resolve, UnixfsV1DirectoryContent, UnixfsV1Resolver, ReadableStorage, ExportWalk } from '../../../index.js'
|
|
9
|
+
|
|
10
|
+
const hamtShardedDirectoryContent: UnixfsV1Resolver = (cid, node, unixfs, path, resolve, depth, blockstore) => {
|
|
11
|
+
function yieldHamtDirectoryContent (options: ExporterOptions = {}): UnixfsV1DirectoryContent {
|
|
12
|
+
options.onProgress?.(new CustomProgressEvent<ExportWalk>('unixfs:exporter:walk:hamt-sharded-directory', {
|
|
13
|
+
cid
|
|
14
|
+
}))
|
|
15
|
+
|
|
16
|
+
return listDirectory(node, path, resolve, depth, blockstore, options)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return yieldHamtDirectoryContent
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function * listDirectory (node: PBNode, path: string, resolve: Resolve, depth: number, blockstore: ReadableStorage, options: ExporterOptions): UnixfsV1DirectoryContent {
|
|
23
|
+
const links = node.Links
|
|
24
|
+
|
|
25
|
+
if (node.Data == null) {
|
|
26
|
+
throw new NotUnixFSError('no data in PBNode')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let dir: UnixFS
|
|
30
|
+
try {
|
|
31
|
+
dir = UnixFS.unmarshal(node.Data)
|
|
32
|
+
} catch (err: any) {
|
|
33
|
+
throw new NotUnixFSError(err.message)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (dir.fanout == null) {
|
|
37
|
+
throw new NotUnixFSError('missing fanout')
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const padLength = (dir.fanout - 1n).toString(16).length
|
|
41
|
+
|
|
42
|
+
const results = pipe(
|
|
43
|
+
links,
|
|
44
|
+
source => map(source, link => {
|
|
45
|
+
return async () => {
|
|
46
|
+
const name = link.Name != null ? link.Name.substring(padLength) : null
|
|
47
|
+
|
|
48
|
+
if (name != null && name !== '') {
|
|
49
|
+
const result = await resolve(link.Hash, name, `${path}/${name}`, [], depth + 1, blockstore, options)
|
|
50
|
+
|
|
51
|
+
return { entries: result.entry == null ? [] : [result.entry] }
|
|
52
|
+
} else {
|
|
53
|
+
// descend into subshard
|
|
54
|
+
const block = await blockstore.get(link.Hash, options)
|
|
55
|
+
node = decode(block)
|
|
56
|
+
|
|
57
|
+
options.onProgress?.(new CustomProgressEvent<ExportWalk>('unixfs:exporter:walk:hamt-sharded-directory', {
|
|
58
|
+
cid: link.Hash
|
|
59
|
+
}))
|
|
60
|
+
|
|
61
|
+
return { entries: listDirectory(node, path, resolve, depth, blockstore, options) }
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}),
|
|
65
|
+
source => parallel(source, {
|
|
66
|
+
ordered: true,
|
|
67
|
+
concurrency: options.blockReadConcurrency
|
|
68
|
+
})
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
for await (const { entries } of results) {
|
|
72
|
+
yield * entries
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default hamtShardedDirectoryContent
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { CustomProgressEvent } from 'progress-events'
|
|
2
|
+
import extractDataFromBlock from '../../../utils/extract-data-from-block.js'
|
|
3
|
+
import validateOffsetAndLength from '../../../utils/validate-offset-and-length.js'
|
|
4
|
+
import type { ExporterOptions, ExportProgress, ExportWalk, UnixfsV1Resolver } from '../../../index.js'
|
|
5
|
+
|
|
6
|
+
const rawContent: UnixfsV1Resolver = (cid, node, unixfs, path, resolve, depth, blockstore) => {
|
|
7
|
+
function * yieldRawContent (options: ExporterOptions = {}): Generator<Uint8Array, void, undefined> {
|
|
8
|
+
if (unixfs.data == null) {
|
|
9
|
+
throw new Error('Raw block had no data')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const size = unixfs.data.length
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
start,
|
|
16
|
+
end
|
|
17
|
+
} = validateOffsetAndLength(size, options.offset, options.length)
|
|
18
|
+
|
|
19
|
+
options.onProgress?.(new CustomProgressEvent<ExportWalk>('unixfs:exporter:walk:raw', {
|
|
20
|
+
cid
|
|
21
|
+
}))
|
|
22
|
+
|
|
23
|
+
const buf = extractDataFromBlock(unixfs.data, 0n, start, end)
|
|
24
|
+
|
|
25
|
+
options.onProgress?.(new CustomProgressEvent<ExportProgress>('unixfs:exporter:progress:unixfs:raw', {
|
|
26
|
+
bytesRead: BigInt(buf.byteLength),
|
|
27
|
+
totalBytes: end - start,
|
|
28
|
+
fileSize: BigInt(unixfs.data.byteLength)
|
|
29
|
+
}))
|
|
30
|
+
|
|
31
|
+
yield buf
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return yieldRawContent
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default rawContent
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { decode, type PBNode } from '@ipld/dag-pb'
|
|
2
|
+
import { UnixFS } from 'ipfs-unixfs'
|
|
3
|
+
import { NotFoundError, NotUnixFSError } from '../../errors.js'
|
|
4
|
+
import findShardCid from '../../utils/find-cid-in-shard.js'
|
|
5
|
+
import contentDirectory from './content/directory.js'
|
|
6
|
+
import contentFile from './content/file.js'
|
|
7
|
+
import contentHamtShardedDirectory from './content/hamt-sharded-directory.js'
|
|
8
|
+
import type { Resolver, UnixfsV1Resolver } from '../../index.js'
|
|
9
|
+
import type { CID } from 'multiformats/cid'
|
|
10
|
+
|
|
11
|
+
const findLinkCid = (node: PBNode, name: string): CID | undefined => {
|
|
12
|
+
const link = node.Links.find(link => link.Name === name)
|
|
13
|
+
|
|
14
|
+
return link?.Hash
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const contentExporters: Record<string, UnixfsV1Resolver> = {
|
|
18
|
+
raw: contentFile,
|
|
19
|
+
file: contentFile,
|
|
20
|
+
directory: contentDirectory,
|
|
21
|
+
'hamt-sharded-directory': contentHamtShardedDirectory,
|
|
22
|
+
metadata: (cid, node, unixfs, path, resolve, depth, blockstore) => {
|
|
23
|
+
return () => []
|
|
24
|
+
},
|
|
25
|
+
symlink: (cid, node, unixfs, path, resolve, depth, blockstore) => {
|
|
26
|
+
return () => []
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// @ts-expect-error types are wrong
|
|
31
|
+
const unixFsResolver: Resolver = async (cid, name, path, toResolve, resolve, depth, blockstore, options) => {
|
|
32
|
+
const block = await blockstore.get(cid, options)
|
|
33
|
+
const node = decode(block)
|
|
34
|
+
let unixfs
|
|
35
|
+
let next
|
|
36
|
+
|
|
37
|
+
if (name == null) {
|
|
38
|
+
name = cid.toString()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (node.Data == null) {
|
|
42
|
+
throw new NotUnixFSError('no data in PBNode')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
unixfs = UnixFS.unmarshal(node.Data)
|
|
47
|
+
} catch (err: any) {
|
|
48
|
+
// non-UnixFS dag-pb node? It could happen.
|
|
49
|
+
throw new NotUnixFSError(err.message)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (path == null) {
|
|
53
|
+
path = name
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (toResolve.length > 0) {
|
|
57
|
+
let linkCid
|
|
58
|
+
|
|
59
|
+
if (unixfs?.type === 'hamt-sharded-directory') {
|
|
60
|
+
// special case - unixfs v1 hamt shards
|
|
61
|
+
linkCid = await findShardCid(node, toResolve[0], blockstore)
|
|
62
|
+
} else {
|
|
63
|
+
linkCid = findLinkCid(node, toResolve[0])
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (linkCid == null) {
|
|
67
|
+
throw new NotFoundError('file does not exist')
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// remove the path component we have resolved
|
|
71
|
+
const nextName = toResolve.shift()
|
|
72
|
+
const nextPath = `${path}/${nextName}`
|
|
73
|
+
|
|
74
|
+
next = {
|
|
75
|
+
cid: linkCid,
|
|
76
|
+
toResolve,
|
|
77
|
+
name: nextName ?? '',
|
|
78
|
+
path: nextPath
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const content = contentExporters[unixfs.type](cid, node, unixfs, path, resolve, depth, blockstore)
|
|
83
|
+
|
|
84
|
+
if (content == null) {
|
|
85
|
+
throw new NotFoundError('could not find content exporter')
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (unixfs.isDirectory()) {
|
|
89
|
+
return {
|
|
90
|
+
entry: {
|
|
91
|
+
type: 'directory',
|
|
92
|
+
name,
|
|
93
|
+
path,
|
|
94
|
+
cid,
|
|
95
|
+
content,
|
|
96
|
+
unixfs,
|
|
97
|
+
depth,
|
|
98
|
+
node,
|
|
99
|
+
size: unixfs.fileSize()
|
|
100
|
+
},
|
|
101
|
+
next
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
entry: {
|
|
107
|
+
type: 'file',
|
|
108
|
+
name,
|
|
109
|
+
path,
|
|
110
|
+
cid,
|
|
111
|
+
content,
|
|
112
|
+
unixfs,
|
|
113
|
+
depth,
|
|
114
|
+
node,
|
|
115
|
+
size: unixfs.fileSize()
|
|
116
|
+
},
|
|
117
|
+
next
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export default unixFsResolver
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function extractDataFromBlock (block: Uint8Array, blockStart: bigint, requestedStart: bigint, requestedEnd: bigint): Uint8Array {
|
|
2
|
+
const blockLength = BigInt(block.length)
|
|
3
|
+
const blockEnd = BigInt(blockStart + blockLength)
|
|
4
|
+
|
|
5
|
+
if (requestedStart >= blockEnd || requestedEnd < blockStart) {
|
|
6
|
+
// If we are looking for a byte range that is starts after the start of the block,
|
|
7
|
+
// return an empty block. This can happen when internal nodes contain data
|
|
8
|
+
return new Uint8Array(0)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (requestedEnd >= blockStart && requestedEnd < blockEnd) {
|
|
12
|
+
// If the end byte is in the current block, truncate the block to the end byte
|
|
13
|
+
block = block.subarray(0, Number(requestedEnd - blockStart))
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (requestedStart >= blockStart && requestedStart < blockEnd) {
|
|
17
|
+
// If the start byte is in the current block, skip to the start byte
|
|
18
|
+
block = block.subarray(Number(requestedStart - blockStart))
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return block
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default extractDataFromBlock
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { decode, type PBLink, type PBNode } from '@ipld/dag-pb'
|
|
2
|
+
import { murmur3128 } from '@multiformats/murmur3'
|
|
3
|
+
import { Bucket, type BucketPosition, createHAMT } from 'hamt-sharding'
|
|
4
|
+
import { UnixFS } from 'ipfs-unixfs'
|
|
5
|
+
import { NotUnixFSError } from '../errors.js'
|
|
6
|
+
import type { ExporterOptions, ShardTraversalContext, ReadableStorage } from '../index.js'
|
|
7
|
+
import type { CID } from 'multiformats/cid'
|
|
8
|
+
|
|
9
|
+
// FIXME: this is copy/pasted from ipfs-unixfs-importer/src/options.js
|
|
10
|
+
const hashFn = async function (buf: Uint8Array): Promise<Uint8Array> {
|
|
11
|
+
return (await murmur3128.encode(buf))
|
|
12
|
+
// Murmur3 outputs 128 bit but, accidentally, IPFS Go's
|
|
13
|
+
// implementation only uses the first 64, so we must do the same
|
|
14
|
+
// for parity..
|
|
15
|
+
.slice(0, 8)
|
|
16
|
+
// Invert buffer because that's how Go impl does it
|
|
17
|
+
.reverse()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const addLinksToHamtBucket = async (links: PBLink[], bucket: Bucket<boolean>, rootBucket: Bucket<boolean>): Promise<void> => {
|
|
21
|
+
const padLength = (bucket.tableSize() - 1).toString(16).length
|
|
22
|
+
await Promise.all(
|
|
23
|
+
links.map(async link => {
|
|
24
|
+
if (link.Name == null) {
|
|
25
|
+
// TODO(@rvagg): what do? this is technically possible
|
|
26
|
+
throw new Error('Unexpected Link without a Name')
|
|
27
|
+
}
|
|
28
|
+
if (link.Name.length === padLength) {
|
|
29
|
+
const pos = parseInt(link.Name, 16)
|
|
30
|
+
|
|
31
|
+
bucket._putObjectAt(pos, new Bucket({
|
|
32
|
+
hash: rootBucket._options.hash,
|
|
33
|
+
bits: rootBucket._options.bits
|
|
34
|
+
}, bucket, pos))
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
await rootBucket.put(link.Name.substring(2), true)
|
|
39
|
+
})
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const toPrefix = (position: number, padLength: number): string => {
|
|
44
|
+
return position
|
|
45
|
+
.toString(16)
|
|
46
|
+
.toUpperCase()
|
|
47
|
+
.padStart(padLength, '0')
|
|
48
|
+
.substring(0, padLength)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const toBucketPath = (position: BucketPosition<boolean>): Array<Bucket<boolean>> => {
|
|
52
|
+
let bucket = position.bucket
|
|
53
|
+
const path = []
|
|
54
|
+
|
|
55
|
+
while (bucket._parent != null) {
|
|
56
|
+
path.push(bucket)
|
|
57
|
+
|
|
58
|
+
bucket = bucket._parent
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
path.push(bucket)
|
|
62
|
+
|
|
63
|
+
return path.reverse()
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const findShardCid = async (node: PBNode, name: string, blockstore: ReadableStorage, context?: ShardTraversalContext, options?: ExporterOptions): Promise<CID | undefined> => {
|
|
67
|
+
if (context == null) {
|
|
68
|
+
if (node.Data == null) {
|
|
69
|
+
throw new NotUnixFSError('no data in PBNode')
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let dir: UnixFS
|
|
73
|
+
try {
|
|
74
|
+
dir = UnixFS.unmarshal(node.Data)
|
|
75
|
+
} catch (err: any) {
|
|
76
|
+
throw new NotUnixFSError(err.message)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (dir.type !== 'hamt-sharded-directory') {
|
|
80
|
+
throw new NotUnixFSError('not a HAMT')
|
|
81
|
+
}
|
|
82
|
+
if (dir.fanout == null) {
|
|
83
|
+
throw new NotUnixFSError('missing fanout')
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const rootBucket = createHAMT<boolean>({
|
|
87
|
+
hashFn,
|
|
88
|
+
bits: Math.log2(Number(dir.fanout))
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
context = {
|
|
92
|
+
rootBucket,
|
|
93
|
+
hamtDepth: 1,
|
|
94
|
+
lastBucket: rootBucket
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const padLength = (context.lastBucket.tableSize() - 1).toString(16).length
|
|
99
|
+
|
|
100
|
+
await addLinksToHamtBucket(node.Links, context.lastBucket, context.rootBucket)
|
|
101
|
+
|
|
102
|
+
const position = await context.rootBucket._findNewBucketAndPos(name)
|
|
103
|
+
let prefix = toPrefix(position.pos, padLength)
|
|
104
|
+
const bucketPath = toBucketPath(position)
|
|
105
|
+
|
|
106
|
+
if (bucketPath.length > context.hamtDepth) {
|
|
107
|
+
context.lastBucket = bucketPath[context.hamtDepth]
|
|
108
|
+
|
|
109
|
+
prefix = toPrefix(context.lastBucket._posAtParent, padLength)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const link = node.Links.find(link => {
|
|
113
|
+
if (link.Name == null) {
|
|
114
|
+
return false
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const entryPrefix = link.Name.substring(0, padLength)
|
|
118
|
+
const entryName = link.Name.substring(padLength)
|
|
119
|
+
|
|
120
|
+
if (entryPrefix !== prefix) {
|
|
121
|
+
// not the entry or subshard we're looking for
|
|
122
|
+
return false
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (entryName !== '' && entryName !== name) {
|
|
126
|
+
// not the entry we're looking for
|
|
127
|
+
return false
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return true
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
if (link == null) {
|
|
134
|
+
return
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (link.Name != null && link.Name.substring(padLength) === name) {
|
|
138
|
+
return link.Hash
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
context.hamtDepth++
|
|
142
|
+
|
|
143
|
+
const block = await blockstore.get(link.Hash, options)
|
|
144
|
+
node = decode(block)
|
|
145
|
+
|
|
146
|
+
return findShardCid(node, name, blockstore, context, options)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export default findShardCid
|