@atcute/car
Advanced tools
Comparing version 1.1.0 to 1.1.1
import * as CBOR from '@atcute/cbor'; | ||
import * as CID from '@atcute/cid'; | ||
import { fromUint8Array } from './reader.js'; | ||
import { readCar } from './reader.js'; | ||
const decoder = new TextDecoder(); | ||
@@ -21,3 +21,3 @@ export class RepoEntry { | ||
export function* iterateAtpRepo(buf) { | ||
const { roots, iterate } = fromUint8Array(new Uint8Array(buf)); | ||
const { roots, iterate } = readCar(new Uint8Array(buf)); | ||
assert(roots.length === 1, `expected only 1 root in the car archive; got=${roots.length}`); | ||
@@ -24,0 +24,0 @@ // Collect all archive entries into a mapping of CID string -> actual bytes |
{ | ||
"type": "module", | ||
"name": "@atcute/car", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "read AT Protocol's CAR (content-addressable archive) repositories", | ||
"license": "MIT", | ||
"repository": { | ||
"url": "https://codeberg.org/mary-ext/atcute" | ||
"url": "https://github.com/mary-ext/atcute", | ||
"directory": "packages/utilities/car" | ||
}, | ||
"files": [ | ||
"dist/" | ||
"dist/", | ||
"lib/", | ||
"!lib/**/*.bench.ts", | ||
"!lib/**/*.test.ts" | ||
], | ||
@@ -18,8 +22,8 @@ "exports": { | ||
"devDependencies": { | ||
"@types/bun": "^1.1.10" | ||
"@types/bun": "^1.1.12" | ||
}, | ||
"dependencies": { | ||
"@atcute/cbor": "^1.0.2", | ||
"@atcute/cid": "^1.0.1", | ||
"@atcute/varint": "^1.0.0" | ||
"@atcute/cbor": "^1.0.6", | ||
"@atcute/varint": "^1.0.1", | ||
"@atcute/cid": "^1.0.2" | ||
}, | ||
@@ -26,0 +30,0 @@ "scripts": { |
# @atcute/car | ||
read AT Protocol's CAR (content-addressable archive) repositories | ||
CAR (content-addressable archvie) repository decoder | ||
```ts | ||
// convenient iterator for reading through an AT Protocol CAR repository | ||
for (const { collection, rkey, record } of iterateAtpRepo(buf)) { | ||
// ... | ||
} | ||
// read through a CAR archive | ||
const { roots, iterate } = readCar(buf); | ||
for (const { cid, bytes } of iterate()) { | ||
// ... | ||
} | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
24299
23
452
18
Updated@atcute/cbor@^1.0.6
Updated@atcute/cid@^1.0.2
Updated@atcute/varint@^1.0.1