Skip to content

Commit

Permalink
chore: use CarBufferReader from @ipld/car (#428)
Browse files Browse the repository at this point in the history
Remove sync car reader code in favour of CarBufferReader that landed
upstream in
[@ipld/car](ipld/js-car#121 (comment))

Fixes #401


❤️

License: MIT
Signed-off-by: Oli Evans <oli@protocol.ai>

---------

Signed-off-by: Oli Evans <oli@protocol.ai>
Co-authored-by: Benjamin Goering <171782+gobengo@users.noreply.github.com>
Co-authored-by: Alan Shaw <alan.shaw@protocol.ai>
  • Loading branch information
3 people authored Mar 27, 2023
1 parent 865f59f commit 23ea480
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 647 deletions.
4 changes: 1 addition & 3 deletions packages/access-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
"dist/src/**/*.d.ts.map"
],
"dependencies": {
"@ipld/car": "^5.0.3",
"@ipld/dag-cbor": "^9.0.0",
"@ipld/car": "^5.1.0",
"@ipld/dag-ucan": "^3.2.0",
"@ucanto/client": "^5.1.0",
"@ucanto/core": "^5.2.0",
Expand All @@ -80,7 +79,6 @@
"p-wait-for": "^5.0.0",
"type-fest": "^3.3.0",
"uint8arrays": "^4.0.3",
"varint": "^6.0.0",
"ws": "^8.12.0",
"zod": "^3.20.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/access-client/src/encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @module
*/
/* eslint-disable unicorn/prefer-spread */
import { CarReader } from './utils/car-reader-sync.js'
import { CarBufferReader } from '@ipld/car/buffer-reader'
import * as CarBufferWriter from '@ipld/car/buffer-writer'
import { Delegation } from '@ucanto/core/delegation'
import * as u8 from 'uint8arrays'
Expand Down Expand Up @@ -72,7 +72,7 @@ export function bytesToDelegations(bytes) {
if (!(bytes instanceof Uint8Array) || bytes.length === 0) {
throw new TypeError('Input should be a non-empty Uint8Array.')
}
const reader = CarReader.fromBytes(bytes)
const reader = CarBufferReader.fromBytes(bytes)
const roots = reader.getRoots()

/** @type {Types.Delegation<T>[]} */
Expand Down
97 changes: 0 additions & 97 deletions packages/access-client/src/utils/car-header-validator.js

This file was deleted.

Loading

0 comments on commit 23ea480

Please # to comment.