3.1.5 • Published 9 days ago

@helia/car v3.1.5

Weekly downloads
-
License
Apache-2.0 OR MIT
Repository
github
Last release
9 days 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 = createHelia({
  // ... helia config
})
const fs = unixfs(helia)

// add some UnixFS data
const cid = await fs.addBytes(fileData1)

// 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 = createHelia({
  // ... helia config
})

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

await c.import(reader)

Install

$ npm i @helia/car

Browser <script> tag

Loading this module through a script tag will make it's 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

3.1.5-a8fdfc2

9 days ago

3.1.5-9fa2427

9 days ago

3.1.5-55b9650

10 days ago

3.1.5

10 days ago

3.1.4-b0d50e9

10 days ago

3.1.4-7419dfc

11 days ago

3.1.4-fa9bd4b

12 days ago

3.1.4-6a62d1c

15 days ago

3.1.4-36081e0

15 days ago

3.1.4-2d070b9

16 days ago

3.1.4-e4e67d0

17 days ago

3.1.4-361fbd3

17 days ago

3.1.4-0a528bb

18 days ago

3.1.4-f6bcbd4

18 days ago

3.1.4-0ecb529

19 days ago

3.1.4-f7f71bb

19 days ago

3.1.4-5e98950

19 days ago

3.1.4-52dbcf2

19 days ago

3.1.3-5d62dfb

19 days ago

3.1.4

19 days ago

3.1.3-59de059

21 days ago

3.1.3-338885f

21 days ago

3.1.2-9ea934e

26 days ago

3.1.2-9c8a2c0

26 days ago

3.1.2-5323724

26 days ago

3.1.3

26 days ago

3.1.2-b1c761d

1 month ago

3.1.2-7cd012a

1 month ago

3.1.2-ba4b7ba

1 month ago

3.1.2-b67ac5f

1 month ago

3.1.2-532d6c4

1 month ago

3.1.2-395cd9e

1 month ago

3.1.2-5cf216b

1 month ago

3.1.2

1 month ago

3.1.2-329652a

1 month ago

3.1.2-e582c63

1 month ago

3.1.2-6ddefb0

1 month ago

3.1.1-1561e4a

1 month ago

3.1.1-d1c497b

1 month ago

3.1.1-9ac5909

1 month ago

3.1.1-b6765fe

2 months ago

3.1.0-2c71b6e

2 months ago

3.1.0-a0d651c

2 months ago

3.1.1-ecf5394

2 months ago

3.1.0-adc5589

2 months ago

3.1.1

2 months ago

3.1.0-8c9bb7d

2 months ago

3.1.0-a64e5de

2 months ago

3.1.0-c69913c

2 months ago

3.1.0-90c6feb

2 months ago

3.0.0-c3f2ed1

2 months ago

3.0.0-1319c61

2 months ago

3.0.0-6f8c15b

2 months ago

3.0.0-77e34fc

2 months ago

3.0.0-917a1bc

2 months ago

3.1.0

2 months ago

3.0.0-1ee6a4a

2 months ago

3.0.0-2d965be

3 months ago

3.0.0-7c3ce21

3 months ago

3.0.0-dc2e7a6

3 months ago

3.0.0-28d62f7

3 months ago

3.0.0-7c07e11

3 months ago

3.0.0-a04e041

3 months ago

3.0.0-754c7af

3 months ago

3.0.0-8db7792

3 months ago

3.0.0-31cdfa8

3 months ago

3.0.0-75d0a5b

3 months ago

3.0.0-9b1ddf8

3 months ago

3.0.0-7a7c0c1

3 months ago

3.0.0-3283a5c

3 months ago

3.0.0-f58d467

3 months ago

3.0.0-3851fe2

3 months ago

3.0.0-5c0c39c

3 months ago

3.0.0-6c88ee1

3 months ago

3.0.0-8a5bc6f

3 months ago

3.0.0-f243de2

3 months ago

3.0.0-ca8d5eb

3 months ago

3.0.0-44f4e88

3 months ago

3.0.0-94b0cd1

3 months ago

3.0.0-e554493

3 months ago

3.0.0

4 months ago

2.0.1-99c94f4

4 months ago

2.0.1-4836d52

4 months ago

2.0.1-19bf9ce

4 months ago

2.0.1-db7d091

4 months ago

2.0.1-031519c

4 months ago

2.0.1-4943c5b

4 months ago

2.0.1-f2853f8

4 months ago

2.0.1-a2229bd

4 months ago

2.0.1-ce74026

4 months ago

2.0.1-a966706

4 months ago

2.0.1-3477b27

4 months ago

2.0.1-843fba4

4 months ago

2.0.1-5a87bbd

4 months ago

2.0.1-163df38

4 months ago

2.0.1-76220cd

4 months ago

2.0.1-ece384a

4 months ago

2.0.1-5c6a066

4 months ago

2.0.1

4 months ago

2.0.0-5c4fd54

4 months ago

2.0.0-10272b4

4 months ago

2.0.0-3f4c6bf

4 months ago

2.0.0-a0692f9

4 months ago

2.0.0

4 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.4

7 months ago

1.0.3

9 months ago

1.0.0

11 months ago

0.0.0

11 months ago