ipfs-unixfs-importer
JavaScript implementation of the UnixFs importer used by IPFS
Last updated 3 months ago by GitHub Actions .
Apache-2.0 OR MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install ipfs-unixfs-importer 
SYNC missed versions from official npm registry.

ipfs-unixfs-importer

ipfs.tech Discuss codecov CI

JavaScript implementation of the UnixFs importer used by IPFS

About

Example

Let's create a little directory to import:

> cd /tmp
> mkdir foo
> echo 'hello' > foo/bar
> echo 'world' > foo/quux

And write the importing logic:

import { importer } from 'ipfs-unixfs-importer'
import { MemoryBlockstore } from 'blockstore-core/memory'
import * as fs from 'node:fs'

// Where the blocks will be stored
const blockstore = new MemoryBlockstore()

// Import path /tmp/foo/
const source = [{
  path: '/tmp/foo/bar',
  content: fs.createReadStream('/tmp/foo/bar')
}, {
  path: '/tmp/foo/quxx',
  content: fs.createReadStream('/tmp/foo/quux')
}]

for await (const entry of importer(source, blockstore)) {
  console.info(entry)
}

When run, metadata about DAGNodes in the created tree is printed until the root:

{
  cid: CID, // see https://github.com/multiformats/js-cid
  path: 'tmp/foo/bar',
  unixfs: UnixFS // see https://github.com/ipfs/js-ipfs-unixfs
}
{
  cid: CID, // see https://github.com/multiformats/js-cid
  path: 'tmp/foo/quxx',
  unixfs: UnixFS // see https://github.com/ipfs/js-ipfs-unixfs
}
{
  cid: CID, // see https://github.com/multiformats/js-cid
  path: 'tmp/foo',
  unixfs: UnixFS // see https://github.com/ipfs/js-ipfs-unixfs
}
{
  cid: CID, // see https://github.com/multiformats/js-cid
  path: 'tmp',
  unixfs: UnixFS // see https://github.com/ipfs/js-ipfs-unixfs
}

Install

$ npm i ipfs-unixfs-importer

Browser <script> tag

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

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

Current Tags

  • 17.1.1                                ...           latest (3 months ago)
  • 9.0.7-rc.7                                ...           next (5 years ago)

154 Versions

  • 17.1.1                                ...           3 months ago
  • 17.1.0                                ...           3 months ago
  • 17.0.1                                ...           7 months ago
  • 17.0.0                                ...           7 months ago
  • 16.1.5                                ...           7 months ago
  • 16.1.4                                ...           9 months ago
  • 16.1.3                                ...           9 months ago
  • 16.1.2                                ...           9 months ago
  • 16.1.1                                ...           9 months ago
  • 16.1.0                                ...           9 months ago
  • 16.0.3                                ...           10 months ago
  • 16.0.2                                ...           a year ago
  • 16.0.1                                ...           a year ago
  • 16.0.0                                ...           a year ago
  • 15.4.0                                ...           a year ago
  • 15.3.4                                ...           a year ago
  • 15.3.3                                ...           a year ago
  • 15.3.2                                ...           2 years ago
  • 15.3.1                                ...           2 years ago
  • 15.3.0                                ...           2 years ago
  • 15.2.6                                ...           2 years ago
  • 15.2.5                                ...           3 years ago
  • 15.2.4                                ...           3 years ago
  • 15.2.3                                ...           3 years ago
  • 15.2.2                                ...           3 years ago
  • 15.2.1                                ...           3 years ago
  • 15.2.0                                ...           3 years ago
  • 15.1.8                                ...           3 years ago
  • 15.1.7                                ...           3 years ago
  • 15.1.6                                ...           3 years ago
  • 15.1.5                                ...           4 years ago
  • 15.1.4                                ...           4 years ago
  • 15.1.3                                ...           4 years ago
  • 15.1.2                                ...           4 years ago
  • 15.1.1                                ...           4 years ago
  • 15.1.0                                ...           4 years ago
  • 15.0.3                                ...           4 years ago
  • 15.0.2                                ...           4 years ago
  • 15.0.1                                ...           4 years ago
  • 15.0.0                                ...           4 years ago
  • 14.0.2                                ...           4 years ago
  • 14.0.1                                ...           4 years ago
  • 14.0.0                                ...           4 years ago
  • 13.0.0                                ...           4 years ago
  • 12.0.1                                ...           4 years ago
  • 12.0.0                                ...           4 years ago
  • 11.0.1                                ...           4 years ago
  • 11.0.0                                ...           4 years ago
  • 10.0.2                                ...           4 years ago
  • 10.0.1                                ...           4 years ago
  • 10.0.0                                ...           4 years ago
  • 9.0.10                                ...           5 years ago
  • 9.0.9                                ...           5 years ago
  • 9.0.8                                ...           5 years ago
  • 9.0.7                                ...           5 years ago
  • 9.0.7-rc.7                                ...           5 years ago
  • 9.0.7-rc.6                                ...           5 years ago
  • 9.0.7-rc.5                                ...           5 years ago
  • 9.0.6                                ...           5 years ago
  • 9.0.5-rc.3                                ...           5 years ago
  • 9.0.5                                ...           5 years ago
  • 9.0.4                                ...           5 years ago
  • 9.0.4-rc.0                                ...           5 years ago
  • 9.0.3-rc.0                                ...           5 years ago
  • 9.0.3                                ...           5 years ago
  • 9.0.2                                ...           5 years ago
  • 9.0.1                                ...           5 years ago
  • 9.0.1-rc.0                                ...           5 years ago
  • 9.0.0                                ...           5 years ago
  • 8.0.3-rc.0                                ...           5 years ago
  • 8.0.2                                ...           5 years ago
  • 8.0.2-rc.0                                ...           5 years ago
  • 8.0.1-rc.0                                ...           5 years ago
  • 8.0.1                                ...           5 years ago
  • 8.0.0                                ...           5 years ago
  • 7.0.4-rc.0                                ...           5 years ago
  • 7.0.3                                ...           6 years ago
  • 7.0.3-rc.0                                ...           6 years ago
  • 7.0.2                                ...           6 years ago
  • 7.0.2-rc.2                                ...           6 years ago
  • 7.0.2-rc.1                                ...           6 years ago
  • 7.0.2-rc.0                                ...           6 years ago
  • 7.0.1-rc.0                                ...           6 years ago
  • 7.0.1                                ...           6 years ago
  • 7.0.0                                ...           6 years ago
  • 6.0.1                                ...           6 years ago
  • 6.0.1-rc.1                                ...           6 years ago
  • 6.0.1-rc.0                                ...           6 years ago
  • 6.0.0                                ...           6 years ago
  • 5.0.1-rc.1                                ...           6 years ago
  • 5.0.0                                ...           6 years ago
  • 4.0.1-rc.3                                ...           6 years ago
  • 4.0.1-rc.1                                ...           6 years ago
  • 4.0.1-rc.0                                ...           6 years ago
  • 4.0.0                                ...           6 years ago
  • 3.1.0                                ...           6 years ago
  • 3.0.5-rc.5                                ...           6 years ago
  • 3.0.5-rc.2                                ...           6 years ago
  • 3.0.4-rc.0                                ...           6 years ago
  • 3.0.4                                ...           6 years ago
  • 3.0.3-rc.0                                ...           6 years ago
  • 3.0.3                                ...           6 years ago
  • 3.0.2                                ...           6 years ago
  • 3.0.2-rc.0                                ...           6 years ago
  • 3.0.1                                ...           6 years ago
  • 2.0.2-rc.3                                ...           6 years ago
  • 3.0.0                                ...           6 years ago
  • 2.0.2-rc.2                                ...           6 years ago
  • 2.0.2                                ...           6 years ago
  • 2.0.2-rc.1                                ...           6 years ago
  • 2.0.1                                ...           7 years ago
  • 2.0.1-rc.0                                ...           7 years ago
  • 2.0.0                                ...           7 years ago
  • 1.0.5-rc.0                                ...           7 years ago
  • 1.0.4                                ...           7 years ago
  • 1.0.3                                ...           7 years ago
  • 1.0.3-rc.0                                ...           7 years ago
  • 1.0.2                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
  • 0.45.1-rc.112                                ...           7 years ago
  • 0.45.1-rc.115                                ...           7 years ago
  • 0.45.0                                ...           7 years ago
  • 0.44.1                                ...           7 years ago
  • 0.44.0                                ...           7 years ago
  • 0.43.1                                ...           7 years ago
  • 0.43.0                                ...           7 years ago
  • 0.42.0                                ...           7 years ago
  • 0.41.0                                ...           7 years ago
  • 0.40.0                                ...           7 years ago
  • 0.39.11                                ...           7 years ago
  • 0.39.10                                ...           7 years ago
  • 0.39.9                                ...           8 years ago
  • 0.39.8                                ...           8 years ago
  • 0.39.7                                ...           8 years ago
  • 0.39.6                                ...           8 years ago
  • 0.39.5                                ...           8 years ago
  • 0.39.4                                ...           8 years ago
  • 0.39.3                                ...           8 years ago
  • 0.39.2                                ...           8 years ago
  • 0.39.1                                ...           8 years ago
  • 0.39.0                                ...           8 years ago
  • 0.38.5                                ...           8 years ago
  • 0.38.4                                ...           8 years ago
  • 0.38.3                                ...           8 years ago
  • 0.38.2                                ...           8 years ago
  • 0.38.1                                ...           8 years ago
  • 0.38.0                                ...           8 years ago
  • 0.37.3                                ...           8 years ago
  • 0.37.2                                ...           8 years ago
  • 0.37.1                                ...           8 years ago
  • 0.37.0                                ...           8 years ago
  • 0.36.0                                ...           8 years ago
  • 0.34.0                                ...           8 years ago
Downloads
Total 550
Today 1
This Week 17
This Month 209
Last Day 6
Last Week 19
Last Month 133
Dependencies (15)
Dev Dependencies (4)

© 2010 - cnpmjs.org x YWFE | Home | YWFE