4.0.0 • Published 10 months ago

@helia/car v4.0.0

Weekly downloads
-
License
Apache-2.0 OR MIT
Repository
github
Last release
10 months ago

@helia/car

ipfs.tech Discuss codecov CI

Import/export car files from Helia

About

@helia/car provides import and export methods to read/write Car files to Helia's blockstore.

See the Car interface for all available operations.

By default it supports dag-pb, dag-cbor, dag-json and raw CIDs, more esoteric DAG walkers can be passed as an init option.

Example - Exporting a DAG as a CAR file

import { createHelia } from 'helia'
import { unixfs } from '@helia/unixfs'
import { car } from '@helia/car'
import { CarWriter } from '@ipld/car'
import { Readable } from 'node:stream'
import nodeFs from 'node:fs'

const helia = await createHelia({
  // ... helia config
})
const fs = unixfs(helia)

// add some UnixFS data
const cid = await fs.addBytes(Uint8Array.from([0, 1, 2, 3, 4]))

// export it as a Car
const c = car(helia)
const { writer, out } = await CarWriter.create(cid)

// `out` needs to be directed somewhere, see the @ipld/car docs for more information
Readable.from(out).pipe(nodeFs.createWriteStream('example.car'))

// write the DAG behind `cid` into the writer
await c.export(cid, writer)

Example - Importing all blocks from a CAR file

import { createHelia } from 'helia'
import { unixfs } from '@helia/unixfs'
import { car } from '@helia/car'
import { CarReader } from '@ipld/car'
import { Readable } from 'node:stream'
import nodeFs from 'node:fs'

const helia = await createHelia({
  // ... helia config
})

// import the car
const inStream = nodeFs.createReadStream('example.car')
const reader = await CarReader.fromIterable(inStream)

const c = car(helia)
await c.import(reader)

Install

$ npm i @helia/car

Browser <script> tag

Loading this module through a script tag will make its exports available as HeliaCar in the global namespace.

<script src="https://unpkg.com/@helia/car/dist/index.min.js"></script>

API Docs

License

Licensed under either of

Contribute

Contributions welcome! Please check out the issues.

Also see our contributing document for more information on how we work, and about contributing in general.

Please be aware that all interactions related to this repo are subject to the IPFS Code of Conduct.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

npm.io

4.0.0-dff82ec

10 months ago

4.0.0-0238ed4

11 months ago

4.0.0-8364296

11 months ago

4.0.0-efc47fa

11 months ago

4.0.0-693c82d

11 months ago

4.0.0-23ebae1

11 months ago

4.0.0-460853f

11 months ago

4.0.0-1b2934b

11 months ago

4.0.0

11 months ago

3.2.1-c04dbf5

11 months ago

3.2.1-efdefc1

11 months ago

3.2.1-2f88fc8

11 months ago

3.2.1-60d8c8a

11 months ago

3.2.1-bc64f47

11 months ago

3.2.1-23e62e1

12 months ago

3.2.0-c9c644c

12 months ago

3.2.1

12 months ago

3.2.0

1 year ago

3.1.5-74ccc92

1 year ago

3.1.5-5fab3a3

1 year ago

3.2.1-8805202

12 months ago

3.1.5-b4877b5

1 year ago

3.2.1-5ff6998

12 months ago

3.1.5-155e24d

1 year ago

3.1.5-f16c9ea

1 year ago

3.2.0-e567717

12 months ago

3.1.5-461d219

1 year ago

3.2.1-9de08ef

12 months ago

3.1.5-3577d3d

1 year ago

3.1.5-5643b1d

1 year ago

3.1.5-011fa92

1 year ago

3.1.5-6952f05

1 year ago

3.1.5-62f77df

1 year ago

3.1.5-21ef20c

1 year ago

3.2.1-ec8bf66

12 months ago

3.2.1-f5a03fc

12 months ago

3.2.1-4f14996

12 months ago

3.2.1-3bf5ab0

12 months ago

3.1.5-e6bca0b

1 year ago

3.1.5-117198f

1 year ago

3.2.0-ac4bdb8

1 year ago

3.2.0-acd876b

12 months ago

3.1.5-f46700f

1 year ago

3.1.5-e6b976a

1 year ago

3.1.5-a8fdfc2

1 year ago

3.1.5-9fa2427

1 year ago

3.1.5-55b9650

1 year ago

3.1.5

1 year ago

3.1.4-b0d50e9

1 year ago

3.1.4-7419dfc

1 year ago

3.1.4-fa9bd4b

1 year ago

3.1.4-6a62d1c

1 year ago

3.1.4-36081e0

1 year ago

3.1.4-2d070b9

1 year ago

3.1.4-e4e67d0

1 year ago

3.1.4-361fbd3

1 year ago

3.1.4-0a528bb

1 year ago

3.1.4-f6bcbd4

1 year ago

3.1.4-0ecb529

1 year ago

3.1.4-f7f71bb

1 year ago

3.1.4-5e98950

1 year ago

3.1.4-52dbcf2

1 year ago

3.1.3-5d62dfb

1 year ago

3.1.4

1 year ago

3.1.3-59de059

1 year ago

3.1.3-338885f

1 year ago

3.1.2-9ea934e

1 year ago

3.1.2-9c8a2c0

1 year ago

3.1.2-5323724

1 year ago

3.1.3

1 year ago

3.1.2-b1c761d

1 year ago

3.1.2-7cd012a

1 year ago

3.1.2-ba4b7ba

1 year ago

3.1.2-b67ac5f

1 year ago

3.1.2-532d6c4

1 year ago

3.1.2-395cd9e

1 year ago

3.1.2-5cf216b

1 year ago

3.1.2

1 year ago

3.1.2-329652a

1 year ago

3.1.2-e582c63

1 year ago

3.1.2-6ddefb0

1 year ago

3.1.1-1561e4a

1 year ago

3.1.1-d1c497b

1 year ago

3.1.1-9ac5909

1 year ago

3.1.1-b6765fe

1 year ago

3.1.0-2c71b6e

1 year ago

3.1.0-a0d651c

1 year ago

3.1.1-ecf5394

1 year ago

3.1.0-adc5589

1 year ago

3.1.1

1 year ago

3.1.0-8c9bb7d

1 year ago

3.1.0-a64e5de

1 year ago

3.1.0-c69913c

1 year ago

3.1.0-90c6feb

2 years ago

3.0.0-c3f2ed1

2 years ago

3.0.0-1319c61

2 years ago

3.0.0-6f8c15b

2 years ago

3.0.0-77e34fc

2 years ago

3.0.0-917a1bc

2 years ago

3.1.0

2 years ago

3.0.0-1ee6a4a

2 years ago

3.0.0-2d965be

2 years ago

3.0.0-7c3ce21

2 years ago

3.0.0-dc2e7a6

2 years ago

3.0.0-28d62f7

2 years ago

3.0.0-7c07e11

2 years ago

3.0.0-a04e041

2 years ago

3.0.0-754c7af

2 years ago

3.0.0-8db7792

2 years ago

3.0.0-31cdfa8

2 years ago

3.0.0-75d0a5b

2 years ago

3.0.0-9b1ddf8

2 years ago

3.0.0-7a7c0c1

2 years ago

3.0.0-3283a5c

2 years ago

3.0.0-f58d467

2 years ago

3.0.0-3851fe2

2 years ago

3.0.0-5c0c39c

2 years ago

3.0.0-6c88ee1

2 years ago

3.0.0-8a5bc6f

2 years ago

3.0.0-f243de2

2 years ago

3.0.0-ca8d5eb

2 years ago

3.0.0-44f4e88

2 years ago

3.0.0-94b0cd1

2 years ago

3.0.0-e554493

2 years ago

3.0.0

2 years ago

2.0.1-99c94f4

2 years ago

2.0.1-4836d52

2 years ago

2.0.1-19bf9ce

2 years ago

2.0.1-db7d091

2 years ago

2.0.1-031519c

2 years ago

2.0.1-4943c5b

2 years ago

2.0.1-f2853f8

2 years ago

2.0.1-a2229bd

2 years ago

2.0.1-ce74026

2 years ago

2.0.1-a966706

2 years ago

2.0.1-3477b27

2 years ago

2.0.1-843fba4

2 years ago

2.0.1-5a87bbd

2 years ago

2.0.1-163df38

2 years ago

2.0.1-76220cd

2 years ago

2.0.1-ece384a

2 years ago

2.0.1-5c6a066

2 years ago

2.0.1

2 years ago

2.0.0-5c4fd54

2 years ago

2.0.0-10272b4

2 years ago

2.0.0-3f4c6bf

2 years ago

2.0.0-a0692f9

2 years ago

2.0.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.0

2 years ago

0.0.0

2 years ago