4.1.2 • Published 6 months ago

@helia/car v4.1.2

Weekly downloads
-
License
Apache-2.0 OR MIT
Repository
github
Last release
6 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.1-73121c2

12 months ago

4.1.1-d5e8799

6 months ago

4.0.3-325b36f

8 months ago

4.0.4-cd1eb58

7 months ago

4.0.0-c09fef2

1 year ago

4.0.0-1aa6c8d

1 year ago

4.0.2-f7155d8

10 months ago

4.0.4

8 months ago

4.0.2-73cb631

9 months ago

4.0.1

1 year ago

4.0.3

9 months ago

4.0.2

11 months ago

4.0.1-87aa9b4

11 months ago

4.1.1-88cc129

6 months ago

4.0.2-afa9a1a

9 months ago

4.0.3-c0bf36e

9 months ago

4.0.2-deb9165

9 months ago

4.1.1-33dbeed

7 months ago

4.0.4-9591175

7 months ago

4.0.1-1c8583c

11 months ago

4.0.1-07e0bc0

12 months ago

4.0.4-bb2ab74

7 months ago

4.0.2-6542cf2

10 months ago

4.1.1-a4dfe0b

6 months ago

4.0.4-3d77369

7 months ago

4.0.2-d602bb2

9 months ago

4.0.2-70b8fa9

9 months ago

4.0.4-313e2c1

7 months ago

4.0.2-99bb059

9 months ago

4.1.2-7a52e951

6 months ago

4.1.2-28a70912

6 months ago

4.0.1-5784ceb

11 months ago

4.0.2-12df657

10 months ago

4.0.1-4710c65

12 months ago

4.0.2-2c7185c

9 months ago

4.0.4-daaa511

7 months ago

4.1.1-e3522f5

7 months ago

4.0.2-91880b0

9 months ago

4.0.1-e45e1de

11 months ago

4.0.2-c7024de

10 months ago

4.0.2-45ca6bc

9 months ago

4.0.2-c015793

10 months ago

4.1.1-60fbbc2

6 months ago

4.1.2-99025383

6 months ago

4.0.1-3d1ce0b

12 months ago

4.0.0-aecac3d

1 year ago

4.0.4-d883eaf

7 months ago

4.0.2-375796a

9 months ago

4.0.1-6a9fd94

12 months ago

4.0.0-e58e49c

1 year ago

4.0.2-2666d64

10 months ago

4.1.0-d43efc7

7 months ago

4.0.2-ac7185a

9 months ago

4.0.2-e6339ed

9 months ago

4.0.1-22c1beb

11 months ago

4.1.2-41bcc88d

6 months ago

4.0.1-075b6ca

12 months ago

4.0.4-ae67092

7 months ago

4.0.0-f7b5d3f

1 year ago

4.1.2-50a97662

6 months ago

4.0.2-15de32f

9 months ago

4.0.1-a7aebd5

11 months ago

4.1.1-d78f91b

7 months ago

4.0.2-ad081b2

9 months ago

4.1.0

7 months ago

4.1.2

6 months ago

4.1.1

7 months ago

4.0.2-eaf789a

9 months ago

4.0.0-dff82ec

1 year ago

4.0.0-0238ed4

1 year ago

4.0.0-8364296

1 year ago

4.0.0-efc47fa

1 year ago

4.0.0-693c82d

1 year ago

4.0.0-23ebae1

1 year ago

4.0.0-460853f

1 year ago

4.0.0-1b2934b

1 year ago

4.0.0

1 year ago

3.2.1-c04dbf5

1 year ago

3.2.1-efdefc1

1 year ago

3.2.1-2f88fc8

1 year ago

3.2.1-60d8c8a

1 year ago

3.2.1-bc64f47

1 year ago

3.2.1-23e62e1

1 year ago

3.2.0-c9c644c

1 year ago

3.2.1

1 year 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

1 year ago

3.1.5-b4877b5

1 year ago

3.2.1-5ff6998

1 year ago

3.1.5-155e24d

1 year ago

3.1.5-f16c9ea

1 year ago

3.2.0-e567717

1 year ago

3.1.5-461d219

1 year ago

3.2.1-9de08ef

1 year ago

3.1.5-3577d3d

1 year ago

3.1.5-5643b1d

1 year ago

3.1.5-011fa92

2 years ago

3.1.5-6952f05

1 year ago

3.1.5-62f77df

1 year ago

3.1.5-21ef20c

2 years ago

3.2.1-ec8bf66

1 year ago

3.2.1-f5a03fc

1 year ago

3.2.1-4f14996

1 year ago

3.2.1-3bf5ab0

1 year 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

1 year ago

3.1.5-f46700f

2 years ago

3.1.5-e6b976a

2 years ago

3.1.5-a8fdfc2

2 years ago

3.1.5-9fa2427

2 years ago

3.1.5-55b9650

2 years ago

3.1.5

2 years ago

3.1.4-b0d50e9

2 years ago

3.1.4-7419dfc

2 years ago

3.1.4-fa9bd4b

2 years ago

3.1.4-6a62d1c

2 years ago

3.1.4-36081e0

2 years ago

3.1.4-2d070b9

2 years ago

3.1.4-e4e67d0

2 years ago

3.1.4-361fbd3

2 years ago

3.1.4-0a528bb

2 years ago

3.1.4-f6bcbd4

2 years ago

3.1.4-0ecb529

2 years ago

3.1.4-f7f71bb

2 years ago

3.1.4-5e98950

2 years ago

3.1.4-52dbcf2

2 years ago

3.1.3-5d62dfb

2 years ago

3.1.4

2 years ago

3.1.3-59de059

2 years ago

3.1.3-338885f

2 years ago

3.1.2-9ea934e

2 years ago

3.1.2-9c8a2c0

2 years ago

3.1.2-5323724

2 years ago

3.1.3

2 years ago

3.1.2-b1c761d

2 years ago

3.1.2-7cd012a

2 years ago

3.1.2-ba4b7ba

2 years ago

3.1.2-b67ac5f

2 years ago

3.1.2-532d6c4

2 years ago

3.1.2-395cd9e

2 years ago

3.1.2-5cf216b

2 years ago

3.1.2

2 years ago

3.1.2-329652a

2 years ago

3.1.2-e582c63

2 years ago

3.1.2-6ddefb0

2 years ago

3.1.1-1561e4a

2 years ago

3.1.1-d1c497b

2 years ago

3.1.1-9ac5909

2 years ago

3.1.1-b6765fe

2 years ago

3.1.0-2c71b6e

2 years ago

3.1.0-a0d651c

2 years ago

3.1.1-ecf5394

2 years ago

3.1.0-adc5589

2 years ago

3.1.1

2 years ago

3.1.0-8c9bb7d

2 years ago

3.1.0-a64e5de

2 years ago

3.1.0-c69913c

2 years 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