@fireproof/vendor 1.2.0 → 2.0.0
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 +19 -109
- package/src/@web3-storage/pail/dist/src/batch/index.d.ts +1 -53
- package/src/@web3-storage/pail/dist/src/batch/index.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/batch/shard.d.ts +1 -1
- package/src/@web3-storage/pail/dist/src/batch/shard.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/block.d.ts +2 -2
- package/src/@web3-storage/pail/dist/src/block.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/clock/index.d.ts +2 -2
- package/src/@web3-storage/pail/dist/src/clock/index.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/crdt/batch/index.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/crdt/index.d.ts +2 -2
- package/src/@web3-storage/pail/dist/src/crdt/index.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/diff.d.ts +3 -3
- package/src/@web3-storage/pail/dist/src/diff.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/index.d.ts +1 -1
- package/src/@web3-storage/pail/dist/src/index.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/merge.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/src/shard.d.ts +4 -4
- package/src/@web3-storage/pail/dist/src/shard.d.ts.map +1 -1
- package/src/@web3-storage/pail/dist/tsconfig.tsbuildinfo +1 -1
- package/src/@web3-storage/pail/src/api.ts +1 -1
- package/src/@web3-storage/pail/src/clock/index.js +1 -1
- package/src/@web3-storage/pail/src/shard.js +1 -1
- package/src/@ipld/car/LICENSE +0 -4
- package/src/@ipld/car/README.md +0 -1132
- package/src/@ipld/car/dist/index.min.js +0 -5
- package/src/@ipld/car/dist/src/api.d.ts +0 -72
- package/src/@ipld/car/dist/src/api.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/buffer-decoder.d.ts +0 -67
- package/src/@ipld/car/dist/src/buffer-decoder.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/buffer-reader-browser.d.ts +0 -116
- package/src/@ipld/car/dist/src/buffer-reader-browser.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/buffer-reader.d.ts +0 -31
- package/src/@ipld/car/dist/src/buffer-reader.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/buffer-writer.d.ts +0 -86
- package/src/@ipld/car/dist/src/buffer-writer.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/coding.d.ts +0 -49
- package/src/@ipld/car/dist/src/coding.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/decoder-common.d.ts +0 -43
- package/src/@ipld/car/dist/src/decoder-common.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/decoder.d.ts +0 -87
- package/src/@ipld/car/dist/src/decoder.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/encoder.d.ts +0 -17
- package/src/@ipld/car/dist/src/encoder.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/header-validator.d.ts +0 -5
- package/src/@ipld/car/dist/src/header-validator.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/index-browser.d.ts +0 -10
- package/src/@ipld/car/dist/src/index-browser.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/index.d.ts +0 -11
- package/src/@ipld/car/dist/src/index.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/indexed-reader-browser.d.ts +0 -5
- package/src/@ipld/car/dist/src/indexed-reader-browser.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/indexed-reader.d.ts +0 -152
- package/src/@ipld/car/dist/src/indexed-reader.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/indexer.d.ts +0 -95
- package/src/@ipld/car/dist/src/indexer.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/iterator-channel.d.ts +0 -7
- package/src/@ipld/car/dist/src/iterator-channel.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/iterator.d.ts +0 -174
- package/src/@ipld/car/dist/src/iterator.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/promise-fs-opts.d.ts +0 -28
- package/src/@ipld/car/dist/src/promise-fs-opts.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/reader-browser.d.ts +0 -151
- package/src/@ipld/car/dist/src/reader-browser.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/reader.d.ts +0 -40
- package/src/@ipld/car/dist/src/reader.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/writer-browser.d.ts +0 -155
- package/src/@ipld/car/dist/src/writer-browser.d.ts.map +0 -1
- package/src/@ipld/car/dist/src/writer.d.ts +0 -45
- package/src/@ipld/car/dist/src/writer.d.ts.map +0 -1
- package/src/@ipld/car/src/api.ts +0 -90
- package/src/@ipld/car/src/buffer-decoder.js +0 -213
- package/src/@ipld/car/src/buffer-reader-browser.js +0 -144
- package/src/@ipld/car/src/buffer-reader.js +0 -51
- package/src/@ipld/car/src/buffer-writer.js +0 -286
- package/src/@ipld/car/src/coding.ts +0 -68
- package/src/@ipld/car/src/decoder-common.js +0 -82
- package/src/@ipld/car/src/decoder.js +0 -347
- package/src/@ipld/car/src/encoder.js +0 -76
- package/src/@ipld/car/src/header-validator.js +0 -214
- package/src/@ipld/car/src/header.ipldsch +0 -18
- package/src/@ipld/car/src/index-browser.js +0 -18
- package/src/@ipld/car/src/index.js +0 -21
- package/src/@ipld/car/src/indexed-reader-browser.js +0 -7
- package/src/@ipld/car/src/indexed-reader.js +0 -211
- package/src/@ipld/car/src/indexer.js +0 -130
- package/src/@ipld/car/src/iterator-channel.js +0 -91
- package/src/@ipld/car/src/iterator.js +0 -267
- package/src/@ipld/car/src/promise-fs-opts.js +0 -46
- package/src/@ipld/car/src/reader-browser.js +0 -194
- package/src/@ipld/car/src/reader.js +0 -54
- package/src/@ipld/car/src/writer-browser.js +0 -250
- package/src/@ipld/car/src/writer.js +0 -81
- package/src/@ipld/dag-cbor/LICENSE +0 -4
- package/src/@ipld/dag-cbor/README.md +0 -80
- package/src/@ipld/dag-cbor/dist/index.min.js +0 -3
- package/src/@ipld/dag-cbor/dist/src/index.d.ts +0 -67
- package/src/@ipld/dag-cbor/dist/src/index.d.ts.map +0 -1
- package/src/@ipld/dag-cbor/src/index.js +0 -147
- package/src/@ipld/dag-json/LICENSE +0 -4
- package/src/@ipld/dag-json/README.md +0 -58
- package/src/@ipld/dag-json/dist/index.min.js +0 -3
- package/src/@ipld/dag-json/dist/src/index.d.ts +0 -12
- package/src/@ipld/dag-json/dist/src/index.d.ts.map +0 -1
- package/src/@ipld/dag-json/src/index.js +0 -291
- package/src/cborg/.github/dependabot.yml +0 -16
- package/src/cborg/.github/workflows/test-and-release.yml +0 -52
- package/src/cborg/CHANGELOG.md +0 -513
- package/src/cborg/LICENSE +0 -13
- package/src/cborg/README.md +0 -515
- package/src/cborg/bench/bench.js +0 -117
- package/src/cborg/bench/json.js +0 -124
- package/src/cborg/bench/package.json +0 -8
- package/src/cborg/cborg/bin.js +0 -189
- package/src/cborg/cborg/common.js +0 -28
- package/src/cborg/cborg/decode.js +0 -211
- package/src/cborg/cborg/diagnostic.js +0 -158
- package/src/cborg/cborg/diagnostic_test.js +0 -117
- package/src/cborg/cborg/encode.js +0 -466
- package/src/cborg/cborg/index.js +0 -33
- package/src/cborg/cborg/is.js +0 -106
- package/src/cborg/cborg/length.js +0 -62
- package/src/cborg/example-bytestrings.js +0 -180
- package/src/cborg/example-json.js +0 -6
- package/src/cborg/example.js +0 -5
- package/src/cborg/interface.ts +0 -59
- package/src/cborg/json/decode.js +0 -462
- package/src/cborg/json/encode.js +0 -302
- package/src/cborg/json/json.js +0 -4
- package/src/cborg/taglib.js +0 -75
- package/src/cborg/test/appendix_a.js +0 -647
- package/src/cborg/test/common.js +0 -18
- package/src/cborg/test/node-test-bin.js +0 -402
- package/src/cborg/test/noop-bin-test.js +0 -3
- package/src/cborg/test/test-0uint.js +0 -103
- package/src/cborg/test/test-1negint.js +0 -96
- package/src/cborg/test/test-2bytes.js +0 -198
- package/src/cborg/test/test-3string.js +0 -136
- package/src/cborg/test/test-4array.js +0 -93
- package/src/cborg/test/test-5map.js +0 -284
- package/src/cborg/test/test-6tag.js +0 -84
- package/src/cborg/test/test-7float.js +0 -131
- package/src/cborg/test/test-bl.js +0 -37
- package/src/cborg/test/test-cbor-vectors.js +0 -107
- package/src/cborg/test/test-decode-errors.js +0 -65
- package/src/cborg/test/test-fuzz.js +0 -42
- package/src/cborg/test/test-json.js +0 -219
- package/src/cborg/test/test-length.js +0 -65
- package/src/cborg/test/test-partial.js +0 -111
- package/src/cborg/tsconfig.json +0 -48
- package/src/cborg/types/cborg/decode.d.ts +0 -43
- package/src/cborg/types/cborg/decode.d.ts.map +0 -1
- package/src/cborg/types/cborg/encode.d.ts +0 -51
- package/src/cborg/types/cborg/encode.d.ts.map +0 -1
- package/src/cborg/types/cborg/index.d.ts +0 -26
- package/src/cborg/types/cborg/index.d.ts.map +0 -1
- package/src/cborg/types/cborg/is.d.ts +0 -6
- package/src/cborg/types/cborg/is.d.ts.map +0 -1
- package/src/cborg/types/example.d.ts +0 -2
- package/src/cborg/types/example.d.ts.map +0 -1
- package/src/cborg/types/interface.d.ts +0 -49
- package/src/cborg/types/interface.d.ts.map +0 -1
- package/src/cborg/types/json/decode.d.ts +0 -67
- package/src/cborg/types/json/decode.d.ts.map +0 -1
- package/src/cborg/types/json/encode.d.ts +0 -11
- package/src/cborg/types/json/encode.d.ts.map +0 -1
- package/src/cborg/types/json/json.d.ts +0 -6
- package/src/cborg/types/json/json.d.ts.map +0 -1
- package/src/cborg/types/taglib.d.ts +0 -18
- package/src/cborg/types/taglib.d.ts.map +0 -1
- package/src/cborg/types/tsconfig.tsbuildinfo +0 -1
- package/src/cborg/types/utils/0uint.d.ts +0 -102
- package/src/cborg/types/utils/0uint.d.ts.map +0 -1
- package/src/cborg/types/utils/1negint.d.ts +0 -59
- package/src/cborg/types/utils/1negint.d.ts.map +0 -1
- package/src/cborg/types/utils/2bytes.d.ts +0 -69
- package/src/cborg/types/utils/2bytes.d.ts.map +0 -1
- package/src/cborg/types/utils/3string.d.ts +0 -46
- package/src/cborg/types/utils/3string.d.ts.map +0 -1
- package/src/cborg/types/utils/4array.d.ts +0 -66
- package/src/cborg/types/utils/4array.d.ts.map +0 -1
- package/src/cborg/types/utils/5map.d.ts +0 -66
- package/src/cborg/types/utils/5map.d.ts.map +0 -1
- package/src/cborg/types/utils/6tag.d.ts +0 -62
- package/src/cborg/types/utils/6tag.d.ts.map +0 -1
- package/src/cborg/types/utils/7float.d.ts +0 -60
- package/src/cborg/types/utils/7float.d.ts.map +0 -1
- package/src/cborg/types/utils/bl.d.ts +0 -26
- package/src/cborg/types/utils/bl.d.ts.map +0 -1
- package/src/cborg/types/utils/byte-utils.d.ts +0 -53
- package/src/cborg/types/utils/byte-utils.d.ts.map +0 -1
- package/src/cborg/types/utils/common.d.ts +0 -8
- package/src/cborg/types/utils/common.d.ts.map +0 -1
- package/src/cborg/types/utils/index.d.ts +0 -13
- package/src/cborg/types/utils/index.d.ts.map +0 -1
- package/src/cborg/types/utils/jump.d.ts +0 -16
- package/src/cborg/types/utils/jump.d.ts.map +0 -1
- package/src/cborg/types/utils/token.d.ts +0 -59
- package/src/cborg/types/utils/token.d.ts.map +0 -1
- package/src/cborg/utils/0uint.js +0 -229
- package/src/cborg/utils/1negint.js +0 -111
- package/src/cborg/utils/2bytes.js +0 -135
- package/src/cborg/utils/3string.js +0 -90
- package/src/cborg/utils/4array.js +0 -114
- package/src/cborg/utils/5map.js +0 -113
- package/src/cborg/utils/6tag.js +0 -81
- package/src/cborg/utils/7float.js +0 -310
- package/src/cborg/utils/bl.js +0 -124
- package/src/cborg/utils/byte-utils.js +0 -417
- package/src/cborg/utils/common.js +0 -11
- package/src/cborg/utils/index.js +0 -12
- package/src/cborg/utils/jump.js +0 -222
- package/src/cborg/utils/token.js +0 -76
- package/src/ipfs-unixfs-exporter/LICENSE +0 -4
- package/src/ipfs-unixfs-exporter/README.md +0 -105
- package/src/ipfs-unixfs-exporter/dist/index.min.js +0 -3
- package/src/ipfs-unixfs-exporter/dist/src/errors.d.ts +0 -57
- package/src/ipfs-unixfs-exporter/dist/src/errors.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/errors.js +0 -73
- package/src/ipfs-unixfs-exporter/dist/src/errors.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/index.d.ts +0 -355
- package/src/ipfs-unixfs-exporter/dist/src/index.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/index.js +0 -197
- package/src/ipfs-unixfs-exporter/dist/src/index.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js +0 -9
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-cbor.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js +0 -9
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/dag-json.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.js +0 -38
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/identity.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.js +0 -30
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/index.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.js +0 -9
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/json.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.js +0 -37
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/raw.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js +0 -29
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/directory.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js +0 -153
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/file.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js +0 -59
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/hamt-sharded-directory.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js +0 -25
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/content/raw.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js +0 -104
- package/src/ipfs-unixfs-exporter/dist/src/resolvers/unixfs-v1/index.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts +0 -3
- package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js +0 -20
- package/src/ipfs-unixfs-exporter/dist/src/utils/extract-data-from-block.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts +0 -6
- package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js +0 -116
- package/src/ipfs-unixfs-exporter/dist/src/utils/find-cid-in-shard.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts +0 -4
- package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js +0 -57
- package/src/ipfs-unixfs-exporter/dist/src/utils/resolve-object-path.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts +0 -6
- package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.d.ts.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js +0 -30
- package/src/ipfs-unixfs-exporter/dist/src/utils/validate-offset-and-length.js.map +0 -1
- package/src/ipfs-unixfs-exporter/dist/typedoc-urls.json +0 -58
- package/src/ipfs-unixfs-exporter/src/errors.ts +0 -87
- package/src/ipfs-unixfs-exporter/src/index.ts +0 -498
- package/src/ipfs-unixfs-exporter/src/resolvers/dag-cbor.ts +0 -12
- package/src/ipfs-unixfs-exporter/src/resolvers/dag-json.ts +0 -12
- package/src/ipfs-unixfs-exporter/src/resolvers/identity.ts +0 -49
- package/src/ipfs-unixfs-exporter/src/resolvers/index.ts +0 -35
- package/src/ipfs-unixfs-exporter/src/resolvers/json.ts +0 -12
- package/src/ipfs-unixfs-exporter/src/resolvers/raw.ts +0 -49
- package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/directory.ts +0 -39
- package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.ts +0 -198
- package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/hamt-sharded-directory.ts +0 -76
- package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/raw.ts +0 -37
- package/src/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.ts +0 -121
- package/src/ipfs-unixfs-exporter/src/utils/extract-data-from-block.ts +0 -24
- package/src/ipfs-unixfs-exporter/src/utils/find-cid-in-shard.ts +0 -149
- package/src/ipfs-unixfs-exporter/src/utils/resolve-object-path.ts +0 -62
- package/src/ipfs-unixfs-exporter/src/utils/validate-offset-and-length.ts +0 -38
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @private
|
|
3
|
-
* @param {BytesReader} reader
|
|
4
|
-
* @returns {Promise<CarReader>}
|
|
5
|
-
*/
|
|
6
|
-
export function decodeReaderComplete(reader: BytesReader): Promise<CarReader>;
|
|
7
|
-
/**
|
|
8
|
-
* @typedef {import('multiformats').CID} CID
|
|
9
|
-
* @typedef {import('./api').Block} Block
|
|
10
|
-
* @typedef {import('./api').CarReader} CarReaderIface
|
|
11
|
-
* @typedef {import('./coding').BytesReader} BytesReader
|
|
12
|
-
* @typedef {import('./coding').CarHeader} CarHeader
|
|
13
|
-
* @typedef {import('./coding').CarV2Header} CarV2Header
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* Provides blockstore-like access to a CAR.
|
|
17
|
-
*
|
|
18
|
-
* Implements the `RootsReader` interface:
|
|
19
|
-
* {@link CarReader.getRoots `getRoots()`}. And the `BlockReader` interface:
|
|
20
|
-
* {@link CarReader.get `get()`}, {@link CarReader.has `has()`},
|
|
21
|
-
* {@link CarReader.blocks `blocks()`} (defined as a `BlockIterator`) and
|
|
22
|
-
* {@link CarReader.cids `cids()`} (defined as a `CIDIterator`).
|
|
23
|
-
*
|
|
24
|
-
* Load this class with either `import { CarReader } from '@ipld/car/reader'`
|
|
25
|
-
* (`const { CarReader } = require('@ipld/car/reader')`). Or
|
|
26
|
-
* `import { CarReader } from '@ipld/car'` (`const { CarReader } = require('@ipld/car')`).
|
|
27
|
-
* The former will likely result in smaller bundle sizes where this is
|
|
28
|
-
* important.
|
|
29
|
-
*
|
|
30
|
-
* @name CarReader
|
|
31
|
-
* @class
|
|
32
|
-
* @implements {CarReaderIface}
|
|
33
|
-
* @property {number} version The version number of the CAR referenced by this
|
|
34
|
-
* reader (should be `1` or `2`).
|
|
35
|
-
*/
|
|
36
|
-
export class CarReader implements CarReaderIface {
|
|
37
|
-
/**
|
|
38
|
-
* Instantiate a {@link CarReader} from a `Uint8Array` blob. This performs a
|
|
39
|
-
* decode fully in memory and maintains the decoded state in memory for full
|
|
40
|
-
* access to the data via the `CarReader` API.
|
|
41
|
-
*
|
|
42
|
-
* @async
|
|
43
|
-
* @static
|
|
44
|
-
* @memberof CarReader
|
|
45
|
-
* @param {Uint8Array} bytes
|
|
46
|
-
* @returns {Promise<CarReader>}
|
|
47
|
-
*/
|
|
48
|
-
static fromBytes(bytes: Uint8Array): Promise<CarReader>;
|
|
49
|
-
/**
|
|
50
|
-
* Instantiate a {@link CarReader} from a `AsyncIterable<Uint8Array>`, such as
|
|
51
|
-
* a [modern Node.js stream](https://nodejs.org/api/stream.html#stream_streams_compatibility_with_async_generators_and_async_iterators).
|
|
52
|
-
* This performs a decode fully in memory and maintains the decoded state in
|
|
53
|
-
* memory for full access to the data via the `CarReader` API.
|
|
54
|
-
*
|
|
55
|
-
* Care should be taken for large archives; this API may not be appropriate
|
|
56
|
-
* where memory is a concern or the archive is potentially larger than the
|
|
57
|
-
* amount of memory that the runtime can handle.
|
|
58
|
-
*
|
|
59
|
-
* @async
|
|
60
|
-
* @static
|
|
61
|
-
* @memberof CarReader
|
|
62
|
-
* @param {AsyncIterable<Uint8Array>} asyncIterable
|
|
63
|
-
* @returns {Promise<CarReader>}
|
|
64
|
-
*/
|
|
65
|
-
static fromIterable(asyncIterable: AsyncIterable<Uint8Array>): Promise<CarReader>;
|
|
66
|
-
/**
|
|
67
|
-
* @constructs CarReader
|
|
68
|
-
* @param {CarHeader|CarV2Header} header
|
|
69
|
-
* @param {Block[]} blocks
|
|
70
|
-
*/
|
|
71
|
-
constructor(header: CarHeader | CarV2Header, blocks: Block[]);
|
|
72
|
-
_header: import("./coding").CarHeader | import("./coding").CarV2Header;
|
|
73
|
-
_blocks: import("./api").Block[];
|
|
74
|
-
_keys: string[];
|
|
75
|
-
/**
|
|
76
|
-
* @property
|
|
77
|
-
* @memberof CarReader
|
|
78
|
-
* @instance
|
|
79
|
-
*/
|
|
80
|
-
get version(): 1 | 2;
|
|
81
|
-
/**
|
|
82
|
-
* Get the list of roots defined by the CAR referenced by this reader. May be
|
|
83
|
-
* zero or more `CID`s.
|
|
84
|
-
*
|
|
85
|
-
* @function
|
|
86
|
-
* @memberof CarReader
|
|
87
|
-
* @instance
|
|
88
|
-
* @async
|
|
89
|
-
* @returns {Promise<CID[]>}
|
|
90
|
-
*/
|
|
91
|
-
getRoots(): Promise<CID[]>;
|
|
92
|
-
/**
|
|
93
|
-
* Check whether a given `CID` exists within the CAR referenced by this
|
|
94
|
-
* reader.
|
|
95
|
-
*
|
|
96
|
-
* @function
|
|
97
|
-
* @memberof CarReader
|
|
98
|
-
* @instance
|
|
99
|
-
* @async
|
|
100
|
-
* @param {CID} key
|
|
101
|
-
* @returns {Promise<boolean>}
|
|
102
|
-
*/
|
|
103
|
-
has(key: CID): Promise<boolean>;
|
|
104
|
-
/**
|
|
105
|
-
* Fetch a `Block` (a `{ cid:CID, bytes:Uint8Array }` pair) from the CAR
|
|
106
|
-
* referenced by this reader matching the provided `CID`. In the case where
|
|
107
|
-
* the provided `CID` doesn't exist within the CAR, `undefined` will be
|
|
108
|
-
* returned.
|
|
109
|
-
*
|
|
110
|
-
* @function
|
|
111
|
-
* @memberof CarReader
|
|
112
|
-
* @instance
|
|
113
|
-
* @async
|
|
114
|
-
* @param {CID} key
|
|
115
|
-
* @returns {Promise<Block | undefined>}
|
|
116
|
-
*/
|
|
117
|
-
get(key: CID): Promise<Block | undefined>;
|
|
118
|
-
/**
|
|
119
|
-
* Returns a `BlockIterator` (`AsyncIterable<Block>`) that iterates over all
|
|
120
|
-
* of the `Block`s (`{ cid:CID, bytes:Uint8Array }` pairs) contained within
|
|
121
|
-
* the CAR referenced by this reader.
|
|
122
|
-
*
|
|
123
|
-
* @function
|
|
124
|
-
* @memberof CarReader
|
|
125
|
-
* @instance
|
|
126
|
-
* @async
|
|
127
|
-
* @generator
|
|
128
|
-
* @returns {AsyncGenerator<Block>}
|
|
129
|
-
*/
|
|
130
|
-
blocks(): AsyncGenerator<Block>;
|
|
131
|
-
/**
|
|
132
|
-
* Returns a `CIDIterator` (`AsyncIterable<CID>`) that iterates over all of
|
|
133
|
-
* the `CID`s contained within the CAR referenced by this reader.
|
|
134
|
-
*
|
|
135
|
-
* @function
|
|
136
|
-
* @memberof CarReader
|
|
137
|
-
* @instance
|
|
138
|
-
* @async
|
|
139
|
-
* @generator
|
|
140
|
-
* @returns {AsyncGenerator<CID>}
|
|
141
|
-
*/
|
|
142
|
-
cids(): AsyncGenerator<CID>;
|
|
143
|
-
}
|
|
144
|
-
export const __browser: true;
|
|
145
|
-
export type CID = import('multiformats').CID;
|
|
146
|
-
export type Block = import('./api').Block;
|
|
147
|
-
export type CarReaderIface = import('./api').CarReader;
|
|
148
|
-
export type BytesReader = import('./coding').BytesReader;
|
|
149
|
-
export type CarHeader = import('./coding').CarHeader;
|
|
150
|
-
export type CarV2Header = import('./coding').CarV2Header;
|
|
151
|
-
//# sourceMappingURL=reader-browser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reader-browser.d.ts","sourceRoot":"","sources":["../../src/reader-browser.js"],"names":[],"mappings":"AAiLA;;;;GAIG;AACH,6CAHW,WAAW,GACT,QAAQ,SAAS,CAAC,CAW9B;AA7LD;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IAuGE;;;;;;;;;;OAUG;IACH,wBAHW,UAAU,GACR,QAAQ,SAAS,CAAC,CAO9B;IAED;;;;;;;;;;;;;;;OAeG;IACH,mCAHW,cAAc,UAAU,CAAC,GACvB,QAAQ,SAAS,CAAC,CAO9B;IA7ID;;;;OAIG;IACH,oBAHW,SAAS,GAAC,WAAW,UACrB,KAAK,EAAE,EAMjB;IAHC,uEAAqB;IACrB,iCAAqB;IACrB,gBAAgD;IAGlD;;;;OAIG;IACH,qBAEC;IAED;;;;;;;;;OASG;IACH,YAFa,QAAQ,GAAG,EAAE,CAAC,CAI1B;IAED;;;;;;;;;;OAUG;IACH,SAHW,GAAG,GACD,QAAQ,OAAO,CAAC,CAI5B;IAED;;;;;;;;;;;;OAYG;IACH,SAHW,GAAG,GACD,QAAQ,KAAK,GAAG,SAAS,CAAC,CAKtC;IAED;;;;;;;;;;;OAWG;IACH,UAFa,eAAe,KAAK,CAAC,CAMjC;IAED;;;;;;;;;;OAUG;IACH,QAFa,eAAe,GAAG,CAAC,CAM/B;CA0CF;AAkBD,6BAA6B;kBA9LhB,OAAO,cAAc,EAAE,GAAG;oBAC1B,OAAO,OAAO,EAAE,KAAK;6BACrB,OAAO,OAAO,EAAE,SAAS;0BACzB,OAAO,UAAU,EAAE,WAAW;wBAC9B,OAAO,UAAU,EAAE,SAAS;0BAC5B,OAAO,UAAU,EAAE,WAAW"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {import('./api').Block} Block
|
|
3
|
-
* @typedef {import('./api').BlockIndex} BlockIndex
|
|
4
|
-
* @typedef {import('./api').CarReader} CarReaderIface
|
|
5
|
-
* @typedef {import('fs').promises.FileHandle} FileHandle
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* @class
|
|
9
|
-
* @implements {CarReaderIface}
|
|
10
|
-
*/
|
|
11
|
-
export class CarReader extends BrowserCarReader implements CarReaderIface {
|
|
12
|
-
/**
|
|
13
|
-
* Reads a block directly from a file descriptor for an open CAR file. This
|
|
14
|
-
* function is **only available in Node.js** and not a browser environment.
|
|
15
|
-
*
|
|
16
|
-
* This function can be used in connection with {@link CarIndexer} which emits
|
|
17
|
-
* the `BlockIndex` objects that are required by this function.
|
|
18
|
-
*
|
|
19
|
-
* The user is responsible for opening and closing the file used in this call.
|
|
20
|
-
*
|
|
21
|
-
* @async
|
|
22
|
-
* @static
|
|
23
|
-
* @memberof CarReader
|
|
24
|
-
* @param {FileHandle | number} fd - A file descriptor from the
|
|
25
|
-
* Node.js `fs` module. Either an integer, from `fs.open()` or a `FileHandle`
|
|
26
|
-
* from `fs.promises.open()`.
|
|
27
|
-
* @param {BlockIndex} blockIndex - An index pointing to the location of the
|
|
28
|
-
* Block required. This `BlockIndex` should take the form:
|
|
29
|
-
* `{cid:CID, blockLength:number, blockOffset:number}`.
|
|
30
|
-
* @returns {Promise<Block>} A `{ cid:CID, bytes:Uint8Array }` pair.
|
|
31
|
-
*/
|
|
32
|
-
static readRaw(fd: FileHandle | number, blockIndex: BlockIndex): Promise<Block>;
|
|
33
|
-
}
|
|
34
|
-
export const __browser: boolean;
|
|
35
|
-
export type Block = import('./api').Block;
|
|
36
|
-
export type BlockIndex = import('./api').BlockIndex;
|
|
37
|
-
export type CarReaderIface = import('./api').CarReader;
|
|
38
|
-
export type FileHandle = import('fs').promises.FileHandle;
|
|
39
|
-
import { CarReader as BrowserCarReader } from './reader-browser.js';
|
|
40
|
-
//# sourceMappingURL=reader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../src/reader.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH;;;GAGG;AACH;IACE;;;;;;;;;;;;;;;;;;;OAmBG;IACH,mBARW,UAAU,GAAG,MAAM,cAGnB,UAAU,GAGR,QAAQ,KAAK,CAAC,CAiB1B;CACF;AAED,gCAA+B;oBAjDlB,OAAO,OAAO,EAAE,KAAK;yBACrB,OAAO,OAAO,EAAE,UAAU;6BAC1B,OAAO,OAAO,EAAE,SAAS;yBACzB,OAAO,IAAI,EAAE,QAAQ,CAAC,UAAU;8CANC,qBAAqB"}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {import('./api').Block} Block
|
|
3
|
-
* @typedef {import('./api').BlockWriter} BlockWriter
|
|
4
|
-
* @typedef {import('./api').WriterChannel} WriterChannel
|
|
5
|
-
* @typedef {import('./coding').CarEncoder} CarEncoder
|
|
6
|
-
* @typedef {import('./coding').IteratorChannel<Uint8Array>} IteratorChannel
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Provides a writer interface for the creation of CAR files.
|
|
10
|
-
*
|
|
11
|
-
* Creation of a `CarWriter` involves the instatiation of an input / output pair
|
|
12
|
-
* in the form of a `WriterChannel`, which is a
|
|
13
|
-
* `{ writer:CarWriter, out:AsyncIterable<Uint8Array> }` pair. These two
|
|
14
|
-
* components form what can be thought of as a stream-like interface. The
|
|
15
|
-
* `writer` component (an instantiated `CarWriter`), has methods to
|
|
16
|
-
* {@link CarWriter.put `put()`} new blocks and {@link CarWriter.put `close()`}
|
|
17
|
-
* the writing operation (finalising the CAR archive). The `out` component is
|
|
18
|
-
* an `AsyncIterable` that yields the bytes of the archive. This can be
|
|
19
|
-
* redirected to a file or other sink. In Node.js, you can use the
|
|
20
|
-
* [`Readable.from()`](https://nodejs.org/api/stream.html#stream_stream_readable_from_iterable_options)
|
|
21
|
-
* API to convert this to a standard Node.js stream, or it can be directly fed
|
|
22
|
-
* to a
|
|
23
|
-
* [`stream.pipeline()`](https://nodejs.org/api/stream.html#stream_stream_pipeline_source_transforms_destination_callback).
|
|
24
|
-
*
|
|
25
|
-
* The channel will provide a form of backpressure. The `Promise` from a
|
|
26
|
-
* `write()` won't resolve until the resulting data is drained from the `out`
|
|
27
|
-
* iterable.
|
|
28
|
-
*
|
|
29
|
-
* It is also possible to ignore the `Promise` from `write()` calls and allow
|
|
30
|
-
* the generated data to queue in memory. This should be avoided for large CAR
|
|
31
|
-
* archives of course due to the memory costs and potential for memory overflow.
|
|
32
|
-
*
|
|
33
|
-
* Load this class with either
|
|
34
|
-
* `import { CarWriter } from '@ipld/car/writer'`
|
|
35
|
-
* (`const { CarWriter } = require('@ipld/car/writer')`). Or
|
|
36
|
-
* `import { CarWriter } from '@ipld/car'`
|
|
37
|
-
* (`const { CarWriter } = require('@ipld/car')`). The former will likely
|
|
38
|
-
* result in smaller bundle sizes where this is important.
|
|
39
|
-
*
|
|
40
|
-
* @name CarWriter
|
|
41
|
-
* @class
|
|
42
|
-
* @implements {BlockWriter}
|
|
43
|
-
*/
|
|
44
|
-
export class CarWriter implements BlockWriter {
|
|
45
|
-
/**
|
|
46
|
-
* Create a new CAR writer "channel" which consists of a
|
|
47
|
-
* `{ writer:CarWriter, out:AsyncIterable<Uint8Array> }` pair.
|
|
48
|
-
*
|
|
49
|
-
* @async
|
|
50
|
-
* @static
|
|
51
|
-
* @memberof CarWriter
|
|
52
|
-
* @param {CID[] | CID | void} roots
|
|
53
|
-
* @returns {WriterChannel} The channel takes the form of
|
|
54
|
-
* `{ writer:CarWriter, out:AsyncIterable<Uint8Array> }`.
|
|
55
|
-
*/
|
|
56
|
-
static create(roots: CID[] | CID | void): WriterChannel;
|
|
57
|
-
/**
|
|
58
|
-
* Create a new CAR appender "channel" which consists of a
|
|
59
|
-
* `{ writer:CarWriter, out:AsyncIterable<Uint8Array> }` pair.
|
|
60
|
-
* This appender does not consider roots and does not produce a CAR header.
|
|
61
|
-
* It is designed to append blocks to an _existing_ CAR archive. It is
|
|
62
|
-
* expected that `out` will be concatenated onto the end of an existing
|
|
63
|
-
* archive that already has a properly formatted header.
|
|
64
|
-
*
|
|
65
|
-
* @async
|
|
66
|
-
* @static
|
|
67
|
-
* @memberof CarWriter
|
|
68
|
-
* @returns {WriterChannel} The channel takes the form of
|
|
69
|
-
* `{ writer:CarWriter, out:AsyncIterable<Uint8Array> }`.
|
|
70
|
-
*/
|
|
71
|
-
static createAppender(): WriterChannel;
|
|
72
|
-
/**
|
|
73
|
-
* Update the list of roots in the header of an existing CAR as represented
|
|
74
|
-
* in a Uint8Array.
|
|
75
|
-
*
|
|
76
|
-
* This operation is an _overwrite_, the total length of the CAR will not be
|
|
77
|
-
* modified. A rejection will occur if the new header will not be the same
|
|
78
|
-
* length as the existing header, in which case the CAR will not be modified.
|
|
79
|
-
* It is the responsibility of the user to ensure that the roots being
|
|
80
|
-
* replaced encode as the same length as the new roots.
|
|
81
|
-
*
|
|
82
|
-
* The byte array passed in an argument will be modified and also returned
|
|
83
|
-
* upon successful modification.
|
|
84
|
-
*
|
|
85
|
-
* @async
|
|
86
|
-
* @static
|
|
87
|
-
* @memberof CarWriter
|
|
88
|
-
* @param {Uint8Array} bytes
|
|
89
|
-
* @param {CID[]} roots - A new list of roots to replace the existing list in
|
|
90
|
-
* the CAR header. The new header must take up the same number of bytes as the
|
|
91
|
-
* existing header, so the roots should collectively be the same byte length
|
|
92
|
-
* as the existing roots.
|
|
93
|
-
* @returns {Promise<Uint8Array>}
|
|
94
|
-
*/
|
|
95
|
-
static updateRootsInBytes(bytes: Uint8Array, roots: CID[]): Promise<Uint8Array>;
|
|
96
|
-
/**
|
|
97
|
-
* @param {CID[]} roots
|
|
98
|
-
* @param {CarEncoder} encoder
|
|
99
|
-
*/
|
|
100
|
-
constructor(roots: CID[], encoder: CarEncoder);
|
|
101
|
-
_encoder: import("./coding").CarEncoder;
|
|
102
|
-
/** @type {Promise<void>} */
|
|
103
|
-
_mutex: Promise<void>;
|
|
104
|
-
_ended: boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Write a `Block` (a `{ cid:CID, bytes:Uint8Array }` pair) to the archive.
|
|
107
|
-
*
|
|
108
|
-
* @function
|
|
109
|
-
* @memberof CarWriter
|
|
110
|
-
* @instance
|
|
111
|
-
* @async
|
|
112
|
-
* @param {Block} block - A `{ cid:CID, bytes:Uint8Array }` pair.
|
|
113
|
-
* @returns {Promise<void>} The returned promise will only resolve once the
|
|
114
|
-
* bytes this block generates are written to the `out` iterable.
|
|
115
|
-
*/
|
|
116
|
-
put(block: Block): Promise<void>;
|
|
117
|
-
/**
|
|
118
|
-
* Finalise the CAR archive and signal that the `out` iterable should end once
|
|
119
|
-
* any remaining bytes are written.
|
|
120
|
-
*
|
|
121
|
-
* @function
|
|
122
|
-
* @memberof CarWriter
|
|
123
|
-
* @instance
|
|
124
|
-
* @async
|
|
125
|
-
* @returns {Promise<void>}
|
|
126
|
-
*/
|
|
127
|
-
close(): Promise<void>;
|
|
128
|
-
/**
|
|
129
|
-
* Returns the version number of the CAR file being written
|
|
130
|
-
*
|
|
131
|
-
* @returns {number}
|
|
132
|
-
*/
|
|
133
|
-
version(): number;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* @class
|
|
137
|
-
* @implements {AsyncIterable<Uint8Array>}
|
|
138
|
-
*/
|
|
139
|
-
export class CarWriterOut implements AsyncIterable<Uint8Array> {
|
|
140
|
-
/**
|
|
141
|
-
* @param {AsyncIterator<Uint8Array>} iterator
|
|
142
|
-
*/
|
|
143
|
-
constructor(iterator: AsyncIterator<Uint8Array>);
|
|
144
|
-
_iterator: AsyncIterator<Uint8Array, any, undefined>;
|
|
145
|
-
_iterating: boolean | undefined;
|
|
146
|
-
[Symbol.asyncIterator](): AsyncIterator<Uint8Array, any, undefined>;
|
|
147
|
-
}
|
|
148
|
-
export const __browser: true;
|
|
149
|
-
export type Block = import('./api').Block;
|
|
150
|
-
export type BlockWriter = import('./api').BlockWriter;
|
|
151
|
-
export type WriterChannel = import('./api').WriterChannel;
|
|
152
|
-
export type CarEncoder = import('./coding').CarEncoder;
|
|
153
|
-
export type IteratorChannel = import('./coding').IteratorChannel<Uint8Array>;
|
|
154
|
-
import { CID } from 'multiformats/cid';
|
|
155
|
-
//# sourceMappingURL=writer-browser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writer-browser.d.ts","sourceRoot":"","sources":["../../src/writer-browser.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH;IAkEE;;;;;;;;;;OAUG;IACH,qBAJW,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,GAChB,aAAa,CASzB;IAED;;;;;;;;;;;;;OAaG;IACH,yBAHa,aAAa,CASzB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,iCAPW,UAAU,SACV,GAAG,EAAE,GAIH,QAAQ,UAAU,CAAC,CAW/B;IA1ID;;;OAGG;IACH,mBAHW,GAAG,EAAE,WACL,UAAU,EAOpB;IAJC,wCAAuB;IACvB,4BAA4B;IAC5B,QADW,QAAQ,IAAI,CAAC,CACa;IACrC,gBAAmB;IAGrB;;;;;;;;;;OAUG;IACH,WAJW,KAAK,GACH,QAAQ,IAAI,CAAC,CAgBzB;IAED;;;;;;;;;OASG;IACH,SAFa,QAAQ,IAAI,CAAC,CASzB;IAED;;;;OAIG;IACH,WAFa,MAAM,CAIlB;CA4EF;AAED;;;GAGG;AACH,mDAF8B,UAAU;IAGtC;;OAEG;IACH,sBAFW,cAAc,UAAU,CAAC,EAInC;IADC,qDAAyB;IAOzB,gCAAsB;IAJxB,oEAMC;CACF;AAuCD,6BAA6B;oBAnPhB,OAAO,OAAO,EAAE,KAAK;0BACrB,OAAO,OAAO,EAAE,WAAW;4BAC3B,OAAO,OAAO,EAAE,aAAa;yBAC7B,OAAO,UAAU,EAAE,UAAU;8BAC7B,OAAO,UAAU,EAAE,eAAe,CAAC,UAAU,CAAC;oBAVvC,kBAAkB"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {import('multiformats/cid').CID} CID
|
|
3
|
-
* @typedef {import('./api').BlockWriter} BlockWriter
|
|
4
|
-
* @typedef {import('fs').promises.FileHandle} FileHandle
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* @class
|
|
8
|
-
* @implements {BlockWriter}
|
|
9
|
-
*/
|
|
10
|
-
export class CarWriter extends BrowserCarWriter implements BlockWriter {
|
|
11
|
-
/**
|
|
12
|
-
* Update the list of roots in the header of an existing CAR file. The first
|
|
13
|
-
* argument must be a file descriptor for CAR file that is open in read and
|
|
14
|
-
* write mode (not append), e.g. `fs.open` or `fs.promises.open` with `'r+'`
|
|
15
|
-
* mode.
|
|
16
|
-
*
|
|
17
|
-
* This operation is an _overwrite_, the total length of the CAR will not be
|
|
18
|
-
* modified. A rejection will occur if the new header will not be the same
|
|
19
|
-
* length as the existing header, in which case the CAR will not be modified.
|
|
20
|
-
* It is the responsibility of the user to ensure that the roots being
|
|
21
|
-
* replaced encode as the same length as the new roots.
|
|
22
|
-
*
|
|
23
|
-
* This function is **only available in Node.js** and not a browser
|
|
24
|
-
* environment.
|
|
25
|
-
*
|
|
26
|
-
* @async
|
|
27
|
-
* @static
|
|
28
|
-
* @memberof CarWriter
|
|
29
|
-
* @param {FileHandle | number} fd - A file descriptor from the
|
|
30
|
-
* Node.js `fs` module. Either an integer, from `fs.open()` or a `FileHandle`
|
|
31
|
-
* from `fs.promises.open()`.
|
|
32
|
-
* @param {CID[]} roots - A new list of roots to replace the existing list in
|
|
33
|
-
* the CAR header. The new header must take up the same number of bytes as the
|
|
34
|
-
* existing header, so the roots should collectively be the same byte length
|
|
35
|
-
* as the existing roots.
|
|
36
|
-
* @returns {Promise<void>}
|
|
37
|
-
*/
|
|
38
|
-
static updateRootsInFile(fd: FileHandle | number, roots: CID[]): Promise<void>;
|
|
39
|
-
}
|
|
40
|
-
export const __browser: boolean;
|
|
41
|
-
export type CID = import('multiformats/cid').CID;
|
|
42
|
-
export type BlockWriter = import('./api').BlockWriter;
|
|
43
|
-
export type FileHandle = import('fs').promises.FileHandle;
|
|
44
|
-
import { CarWriter as BrowserCarWriter } from './writer-browser.js';
|
|
45
|
-
//# sourceMappingURL=writer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/writer.js"],"names":[],"mappings":"AAKA;;;;GAIG;AAEH;;;GAGG;AACH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,6BATW,UAAU,GAAG,MAAM,SAGnB,GAAG,EAAE,GAIH,QAAQ,IAAI,CAAC,CAoCzB;CACF;AAED,gCAA+B;kBA1ElB,OAAO,kBAAkB,EAAE,GAAG;0BAC9B,OAAO,OAAO,EAAE,WAAW;yBAC3B,OAAO,IAAI,EAAE,QAAQ,CAAC,UAAU;8CALC,qBAAqB"}
|
package/src/@ipld/car/src/api.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { CID } from 'multiformats/cid'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Literally any `Iterable` (async or regular).
|
|
5
|
-
*/
|
|
6
|
-
export type AwaitIterable<T> = Iterable<T> | AsyncIterable<T>
|
|
7
|
-
|
|
8
|
-
export type { CID }
|
|
9
|
-
/* Generic types for interfacing with block storage */
|
|
10
|
-
|
|
11
|
-
export interface Block {
|
|
12
|
-
cid: CID
|
|
13
|
-
bytes: Uint8Array
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface BlockHeader {
|
|
17
|
-
cid: CID
|
|
18
|
-
length: number
|
|
19
|
-
blockLength: number
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface BlockIndex extends BlockHeader {
|
|
23
|
-
offset: number
|
|
24
|
-
blockOffset: number
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface RootsReader {
|
|
28
|
-
version: number
|
|
29
|
-
getRoots(): Promise<CID[]>
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface RootsBufferReader {
|
|
33
|
-
version: number
|
|
34
|
-
getRoots(): CID[]
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface BlockIterator extends AsyncIterable<Block> {}
|
|
38
|
-
|
|
39
|
-
export interface CIDIterator extends AsyncIterable<CID> {}
|
|
40
|
-
|
|
41
|
-
export interface BlockReader {
|
|
42
|
-
has(key: CID): Promise<boolean>
|
|
43
|
-
get(key: CID): Promise<Block | undefined>
|
|
44
|
-
blocks(): BlockIterator
|
|
45
|
-
cids(): CIDIterator
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface BlockBufferReader {
|
|
49
|
-
has(key: CID): boolean
|
|
50
|
-
get(key: CID): Block | undefined
|
|
51
|
-
blocks(): Iterable<Block>
|
|
52
|
-
cids(): Iterable<CID>
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface BlockWriter {
|
|
56
|
-
put(block: Block): Promise<void>
|
|
57
|
-
close(): Promise<void>
|
|
58
|
-
version(): number
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface CarBufferWriter {
|
|
62
|
-
addRoot(root: CID, options?: { resize?: boolean }): CarBufferWriter
|
|
63
|
-
write(block: Block): CarBufferWriter
|
|
64
|
-
close(options?: { resize?: boolean }): Uint8Array
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface CarBufferWriterOptions {
|
|
68
|
-
roots?: CID[] // defaults to []
|
|
69
|
-
byteOffset?: number // defaults to 0
|
|
70
|
-
byteLength?: number // defaults to buffer.byteLength
|
|
71
|
-
|
|
72
|
-
headerSize?: number // defaults to size needed for provided roots
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface WriterChannel {
|
|
76
|
-
writer: BlockWriter
|
|
77
|
-
out: AsyncIterable<Uint8Array>
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface CarReader extends BlockReader, RootsReader {}
|
|
81
|
-
export interface CarBufferReader extends BlockBufferReader, RootsBufferReader {}
|
|
82
|
-
|
|
83
|
-
/* Specific implementations for CAR block storage */
|
|
84
|
-
|
|
85
|
-
/*
|
|
86
|
-
export interface CarBlockIterator extends BlockIterator, RootsReader {}
|
|
87
|
-
export interface CarCIDIterator extends CIDIterator, RootsReader {}
|
|
88
|
-
export interface CarIndexer extends AsyncIterable<BlockIndex>, RootsReader {}
|
|
89
|
-
export interface CarWriter extends BlockWriter {}
|
|
90
|
-
*/
|