13.5.0 • Published 3 months ago

ipfs-unixfs-exporter v13.5.0

Weekly downloads
5,136
License
Apache-2.0 OR MIT
Repository
github
Last release
3 months ago

ipfs-unixfs-exporter

ipfs.tech Discuss codecov CI

JavaScript implementation of the UnixFs exporter used by IPFS

About

The UnixFS Exporter provides a means to read DAGs from a blockstore given a CID.

Example

// import a file and export it again
import { importer } from 'ipfs-unixfs-importer'
import { exporter } from 'ipfs-unixfs-exporter'
import { MemoryBlockstore } from 'blockstore-core/memory'

// Should contain the blocks we are trying to export
const blockstore = new MemoryBlockstore()
const files = []

for await (const file of importer([{
  path: '/foo/bar.txt',
  content: new Uint8Array([0, 1, 2, 3])
}], blockstore)) {
  files.push(file)
}

console.info(files[0].cid) // Qmbaz

const entry = await exporter(files[0].cid, blockstore)

console.info(entry.cid) // Qmqux
console.info(entry.path) // Qmbaz/foo/bar.txt
console.info(entry.name) // bar.txt
console.info(entry.unixfs.fileSize()) // 4

// stream content from unixfs node
const size = entry.unixfs.fileSize()
const bytes = new Uint8Array(size)
let offset = 0

for await (const buf of entry.content()) {
  bytes.set(buf, offset)
  offset += chunk.length
}

console.info(bytes) // 0, 1, 2, 3

Install

$ npm i ipfs-unixfs-exporter

Browser <script> tag

Loading this module through a script tag will make it's exports available as IpfsUnixfsExporter in the global namespace.

<script src="https://unpkg.com/ipfs-unixfs-exporter/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

13.5.0

3 months ago

13.3.1

4 months ago

13.4.0

4 months ago

13.3.0

4 months ago

13.2.4

4 months ago

13.2.5

4 months ago

13.2.3

4 months ago

13.2.2

8 months ago

13.1.7

8 months ago

13.2.0

8 months ago

13.2.1

8 months ago

13.1.6

10 months ago

13.1.5

12 months ago

13.1.3

12 months ago

13.1.4

12 months ago

13.1.1

12 months ago

13.1.2

12 months ago

12.0.0

1 year ago

12.0.1

1 year ago

12.0.2

1 year ago

13.0.6

1 year ago

13.0.4

1 year ago

13.0.5

1 year ago

13.0.2

1 year ago

13.0.3

1 year ago

13.0.0

1 year ago

13.0.1

1 year ago

13.1.0

1 year ago

10.0.1

1 year ago

11.0.0

1 year ago

10.0.0

1 year ago

9.0.2

1 year ago

9.0.1

2 years ago

9.0.0

2 years ago

8.0.5

2 years ago

8.0.6

2 years ago

7.0.9

2 years ago

7.0.10

2 years ago

7.0.11

2 years ago

8.0.4

2 years ago

8.0.1

2 years ago

8.0.0

2 years ago

8.0.3

2 years ago

8.0.2

2 years ago

7.0.8

2 years ago

7.0.7

2 years ago

7.0.7-rc.7

2 years ago

7.0.7-rc.5

2 years ago

7.0.7-rc.6

2 years ago

7.0.6

3 years ago

7.0.5-rc.3

3 years ago

7.0.5

3 years ago

7.0.4

3 years ago

7.0.4-rc.0

3 years ago

7.0.3

3 years ago

7.0.3-rc.0

3 years ago

6.0.3-rc.0

3 years ago

7.0.1-rc.0

3 years ago

7.0.0

3 years ago

7.0.2

3 years ago

7.0.1

3 years ago

6.0.2-rc.0

3 years ago

6.0.2

3 years ago

6.0.1

3 years ago

6.0.1-rc.0

3 years ago

5.0.4-rc.0

3 years ago

6.0.0

3 years ago

5.0.3-rc.0

3 years ago

5.0.3

3 years ago

5.0.2

3 years ago

5.0.2-rc.2

3 years ago

5.0.2-rc.1

3 years ago

5.0.2-rc.0

3 years ago

5.0.1

3 years ago

5.0.1-rc.0

3 years ago

5.0.0

3 years ago

4.0.1-rc.1

3 years ago

4.0.1

3 years ago

4.0.1-rc.0

3 years ago

4.0.0

3 years ago

3.0.8-rc.1

3 years ago

3.0.7

3 years ago

3.0.7-rc.1

3 years ago

3.0.7-rc.3

3 years ago

3.0.7-rc.0

3 years ago

3.0.6

3 years ago

3.0.5

3 years ago

3.0.5-rc.5

3 years ago

3.0.5-rc.2

3 years ago

3.0.4-rc.0

4 years ago

3.0.4

4 years ago

3.0.3

4 years ago

3.0.3-rc.0

4 years ago

3.0.2

4 years ago

3.0.2-rc.0

4 years ago

3.0.1

4 years ago

2.0.2-rc.3

4 years ago

3.0.0

4 years ago

2.0.2-rc.2

4 years ago

2.0.2

4 years ago

2.0.2-rc.1

4 years ago

2.0.1

4 years ago

2.0.1-rc.0

4 years ago

2.0.0

4 years ago

1.1.1-rc.0

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.3-rc.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.41.2-rc.115

4 years ago

0.41.2-rc.112

4 years ago

0.41.1

4 years ago

0.41.0

4 years ago

0.40.0

4 years ago

0.39.0

4 years ago

0.38.0

5 years ago

0.37.7

5 years ago

0.37.6

5 years ago

0.37.5

5 years ago

0.37.4

5 years ago

0.37.3

5 years ago

0.37.2

5 years ago

0.37.1

5 years ago

0.37.0

5 years ago

0.36.1

5 years ago

0.36.0

5 years ago

0.35.9

5 years ago

0.35.8

5 years ago

0.35.7

5 years ago

0.35.6

5 years ago

0.35.5

5 years ago

0.35.4

5 years ago

0.35.2

5 years ago

0.35.1

5 years ago

0.35.0

5 years ago

0.34.0

5 years ago