Skip to content

Latest commit

 

History

History
80 lines (50 loc) · 3.7 KB

README.md

File metadata and controls

80 lines (50 loc) · 3.7 KB

ipfs-utils

ipfs.tech Discuss codecov CI

Package to aggregate shared logic and dependencies for the IPFS ecosystem

Table of contents

Install

$ npm i ipfs-utils

Browser <script> tag

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

<script src="https://unpkg.com/ipfs-utils/dist/index.min.js"></script>

ipfs-utils aims to provide single function default export per file (with a few exceptions) scoped in 3 general categories:

  • General use
  • Data structs wrangling (arrays, objects, streams, etc)
  • IPFS core subsystems

General use and Data structs wrangling should try to be just re-exports of community packages.

The IPFS ecosystem has lots of repos with it comes several problems like:

  • Domain logic dedupe - all interface-core implementations shared a lot of logic like validation, streams handling, etc.
  • Dependencies management - it's really easy with so many repos for dependencies to go out of control, they become outdated, different repos use different modules to do the same thing (like merging defaults options), browser bundles ends up with multiple versions of the same package, bumping versions is cumbersome to do because we need to go through several repos, etc.

These problems are the motivation for this package, having shared logic in this package avoids creating cyclic dependencies, centralizes common use modules/functions (exactly like aegir does for the tooling), semantic versioning for 3rd party dependencies is handled in one single place (a good example is going from streams 2 to 3) and maintainers should only care about having ipfs-utils updated.

Usage

Each function should be imported directly.

const validateAddInput = require('ipfs-utils/src/files/add-input-validation')

validateAddInput(Buffer.from('test'))
// true

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.