npm install ipfs-unixfs-exporter

JavaScript implementation of the UnixFs exporter used by IPFS

About ipfs-unixfs-exporter

The npm package "ipfs-unixfs-exporter" is an essential tool for developers working with the InterPlanetary File System (IPFS). It provides a robust JavaScript implementation of the UnixFs exporter, which is crucial for managing file data within the IPFS network. This package enables the efficient extraction of files and directories from IPFS, which uses a Unix FileSystem format. By utilizing "ipfs-unixfs-exporter", developers can easily navigate and manipulate complex data structures stored on IPFS, making it an invaluable resource for applications that require decentralized file storage solutions.

To get started with this powerful tool, developers can use the command `npm install ipfs-unixfs-exporter`. This simple installation process integrates seamlessly into any Node.js project, allowing for immediate use in existing or new applications. Once installed, the package facilitates the export of files, directories, and other data types from IPFS, adhering to the UnixFs specification. This capability is particularly beneficial for applications that need to retrieve large datasets or hierarchically structured data efficiently and reliably.

The "ipfs-unixfs-exporter" not only enhances file handling capabilities but also contributes to the scalability and performance of applications built on IPFS. By streamlining access to IPFS data, developers can improve the responsiveness of their applications, leading to a better user experience. Moreover, the package supports various file types and data structures, ensuring versatility across different use cases. Whether for content distribution, data backup, or collaborative projects, "ipfs-unixfs-exporter" stands out as a critical component in leveraging the full potential of decentralized storage solutions.

More from ipfs

ipfs npm packages

Find the best node modules for your project.

Search npm

interface-datastore

datastore...

Read more
,

ipfs-unixfs

JavaScript implementation of IPFS' unixfs (a Unix FileSystem representation on top of a...

Read more
,

hamt-sharding

JavaScript implementation of sharding using hash array mapped...

Read more
,

ipfs-unixfs-importer

JavaScript implementation of the UnixFs importer used by...

Read more
,

is-ipfs

A set of utilities to help identify IPFS resources on the...

Read more
,

ipfs-unixfs-exporter

JavaScript implementation of the UnixFs exporter used by...

Read more
,

blockstore-core

Contains various implementations of the API contract described in...

Read more
,

ipfs-car

Convert files to content-addressed archives (...

Read more
,

datastore-core

Wrapper implementation for...

Read more
,

ipns

IPNS record...

Read more
,

datastore-level

Datastore implementation with level(up|down)...

Read more
,

ipfs-bitswap

JavaScript implementation of the Bitswap data exchange protocol used by...

Read more

Dependencies

Core dependencies of this npm package and its dev dependencies.

aegir, npm-run-all

Documentation

A README file for the ipfs-unixfs-exporter code repository. View Code

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.