ipfs-unixfs-importer
JavaScript implementation of the UnixFs importer used by IPFS
Last updated 3 years ago by achingbrain .
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 it's 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

  • 15.2.5                                ...           latest (9 months ago)
  • 9.0.7-rc.7                                ...           next (3 years ago)

133 Versions

  • 15.2.5                                ...           9 months ago
  • 15.2.4                                ...           a year ago
  • 15.2.3                                ...           a year ago
  • 15.2.2                                ...           a year ago
  • 15.2.1                                ...           a year ago
  • 15.2.0                                ...           a year ago
  • 15.1.8                                ...           a year ago
  • 15.1.7                                ...           a year ago
  • 15.1.6                                ...           a year ago
  • 15.1.5                                ...           2 years ago
  • 15.1.4                                ...           2 years ago
  • 15.1.3                                ...           2 years ago
  • 15.1.2                                ...           2 years ago
  • 15.1.1                                ...           2 years ago
  • 15.1.0                                ...           2 years ago
  • 15.0.3                                ...           2 years ago
  • 15.0.2                                ...           2 years ago
  • 15.0.1                                ...           2 years ago
  • 15.0.0                                ...           2 years ago
  • 14.0.2                                ...           2 years ago
  • 14.0.1                                ...           2 years ago
  • 14.0.0                                ...           2 years ago
  • 13.0.0                                ...           2 years ago
  • 12.0.1                                ...           2 years ago
  • 12.0.0                                ...           2 years ago
  • 11.0.1                                ...           2 years ago
  • 11.0.0                                ...           2 years ago
  • 10.0.2                                ...           2 years ago
  • 10.0.1                                ...           2 years ago
  • 10.0.0                                ...           2 years ago
  • 9.0.10                                ...           3 years ago
  • 9.0.9                                ...           3 years ago
  • 9.0.8                                ...           3 years ago
  • 9.0.7                                ...           3 years ago
  • 9.0.7-rc.7                                ...           3 years ago
  • 9.0.7-rc.6                                ...           3 years ago
  • 9.0.7-rc.5                                ...           3 years ago
  • 9.0.6                                ...           3 years ago
  • 9.0.5-rc.3                                ...           3 years ago
  • 9.0.5                                ...           3 years ago
  • 9.0.4                                ...           3 years ago
  • 9.0.4-rc.0                                ...           3 years ago
  • 9.0.3-rc.0                                ...           3 years ago
  • 9.0.3                                ...           3 years ago
  • 9.0.2                                ...           3 years ago
  • 9.0.1                                ...           3 years ago
  • 9.0.1-rc.0                                ...           3 years ago
  • 9.0.0                                ...           3 years ago
  • 8.0.3-rc.0                                ...           3 years ago
  • 8.0.2                                ...           3 years ago
  • 8.0.2-rc.0                                ...           3 years ago
  • 8.0.1-rc.0                                ...           3 years ago
  • 8.0.1                                ...           3 years ago
  • 8.0.0                                ...           3 years ago
  • 7.0.4-rc.0                                ...           3 years ago
  • 7.0.3                                ...           4 years ago
  • 7.0.3-rc.0                                ...           4 years ago
  • 7.0.2                                ...           4 years ago
  • 7.0.2-rc.2                                ...           4 years ago
  • 7.0.2-rc.1                                ...           4 years ago
  • 7.0.2-rc.0                                ...           4 years ago
  • 7.0.1-rc.0                                ...           4 years ago
  • 7.0.1                                ...           4 years ago
  • 7.0.0                                ...           4 years ago
  • 6.0.1                                ...           4 years ago
  • 6.0.1-rc.1                                ...           4 years ago
  • 6.0.1-rc.0                                ...           4 years ago
  • 6.0.0                                ...           4 years ago
  • 5.0.1-rc.1                                ...           4 years ago
  • 5.0.0                                ...           4 years ago
  • 4.0.1-rc.3                                ...           4 years ago
  • 4.0.1-rc.1                                ...           4 years ago
  • 4.0.1-rc.0                                ...           4 years ago
  • 4.0.0                                ...           4 years ago
  • 3.1.0                                ...           4 years ago
  • 3.0.5-rc.5                                ...           4 years ago
  • 3.0.5-rc.2                                ...           4 years ago
  • 3.0.4-rc.0                                ...           4 years ago
  • 3.0.4                                ...           4 years ago
  • 3.0.3-rc.0                                ...           4 years ago
  • 3.0.3                                ...           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                                ...           5 years ago
  • 2.0.2-rc.1                                ...           5 years ago
  • 2.0.1                                ...           5 years ago
  • 2.0.1-rc.0                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.0.5-rc.0                                ...           5 years ago
  • 1.0.4                                ...           5 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.3-rc.0                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.45.1-rc.112                                ...           5 years ago
  • 0.45.1-rc.115                                ...           5 years ago
  • 0.45.0                                ...           5 years ago
  • 0.44.1                                ...           5 years ago
  • 0.44.0                                ...           5 years ago
  • 0.43.1                                ...           5 years ago
  • 0.43.0                                ...           5 years ago
  • 0.42.0                                ...           5 years ago
  • 0.41.0                                ...           5 years ago
  • 0.40.0                                ...           5 years ago
  • 0.39.11                                ...           6 years ago
  • 0.39.10                                ...           6 years ago
  • 0.39.9                                ...           6 years ago
  • 0.39.8                                ...           6 years ago
  • 0.39.7                                ...           6 years ago
  • 0.39.6                                ...           6 years ago
  • 0.39.5                                ...           6 years ago
  • 0.39.4                                ...           6 years ago
  • 0.39.3                                ...           6 years ago
  • 0.39.2                                ...           6 years ago
  • 0.39.1                                ...           6 years ago
  • 0.39.0                                ...           6 years ago
  • 0.38.5                                ...           6 years ago
  • 0.38.4                                ...           6 years ago
  • 0.38.3                                ...           6 years ago
  • 0.38.2                                ...           6 years ago
  • 0.38.1                                ...           6 years ago
  • 0.38.0                                ...           6 years ago
  • 0.37.3                                ...           6 years ago
  • 0.37.2                                ...           6 years ago
  • 0.37.1                                ...           6 years ago
  • 0.37.0                                ...           6 years ago
  • 0.36.0                                ...           6 years ago
  • 0.34.0                                ...           6 years ago
Downloads
Total 10
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (15)
Dev Dependencies (12)

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