Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ipfs-utils

ipfs323.7kApache-2.0 OR MIT9.0.14TypeScript support: included

Package to aggregate shared logic and dependencies for the IPFS ecosystem

readme

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.

changelog

9.0.14 (2023-01-13)

Dependencies

9.0.13 (2023-01-11)

Bug Fixes

  • restore old stream conversion (d7495e4)

9.0.12 (2023-01-11)

Bug Fixes

9.0.11 (2023-01-11)

Bug Fixes

  • add missing it-all dependency (6679755)

9.0.10 (2023-01-11)

Bug Fixes

Trivial Changes

  • use semantic-release for releases (3267e99)

9.0.9 (2022-11-18)

Bug Fixes

  • only export one thing from glob source (#223) (fbbf8f0)

9.0.8 (2022-11-18)

Bug Fixes

Trivial Changes

  • Update .github/workflows/stale.yml [skip ci] (9229386)

9.0.7 (2022-06-23)

Bug Fixes

9.0.6 (2022-04-19)

Bug Fixes

9.0.5 (2022-03-01)

Bug Fixes

9.0.4 (2022-01-14)

Trivial Changes

9.0.2 (2021-09-28)

9.0.1 (2021-09-23)

9.0.0 (2021-09-23)

Features

BREAKING CHANGES

  • the globSource call signature has changed and no longer supports the recursive or ignore options

8.1.6 (2021-08-27)

Bug Fixes

8.1.5 (2021-08-19)

8.1.4 (2021-07-09)

8.1.3 (2021-06-18)

Bug Fixes

8.1.2 (2021-06-01)

8.1.1 (2021-05-28)

Bug Fixes

  • use node-fetch fork with fix for stream closed prematurely bug (#127) (4ad105a)

8.1.0 (2021-05-21)

Features

  • add React Native android support (#91) (b2b02a5)

8.0.0 (2021-05-10)

chore

BREAKING CHANGES

  • text encoder/decoder files have been removed

7.0.0 (2021-05-04)

Bug Fixes

BREAKING CHANGES

  • ResponseWithURL type is not exported any more as it uses a private name and causes an inconsistency between node and the browser

6.0.8 (2021-04-30)

Bug Fixes

  • exclude glob-source.js in browser build (#121) (c4071d9)

6.0.7 (2021-04-14)

6.0.6 (2021-04-06)

6.0.5 (2021-04-01)

Bug Fixes

6.0.4 (2021-03-22)

Bug Fixes

  • allow all supported unixfs time types (#111) (72e0097)

6.0.3 (2021-03-15)

6.0.2 (2021-03-15)

6.0.1 (2021-02-07)

6.0.0 (2021-01-15)

Features

BREAKING CHANGES

  • removed globalThis and normalise-input, format-mode and format-mtime

5.0.1 (2020-11-25)

5.0.0 (2020-11-16)

Features

4.0.1 (2020-11-09)

Bug Fixes

4.0.0 (2020-10-10)

Bug Fixes

3.0.0 (2020-08-18)

Bug Fixes

  • revert "feat: http upload/download progress handlers" (#58) (1bbe957)

2.4.0 (2020-08-12)

Features

2.3.1 (2020-06-18)

Features

2.3.0 (2020-06-10)

Bug Fixes

  • text encoder / decoder exports (c4792e1)

2.2.2 (2020-05-05)

Bug Fixes

  • fix headers and abort signals (#41) (ad977a9)
  • ci: add empty commit to fix lint checks on master (ad2fdc4)

2.2.1 (2020-05-01)

Bug Fixes

Features

  • pass in Options Object to http Constructor (#37) (727f28d)

2.2.0 (2020-04-14)

Features

2.1.0 (2020-04-13)

Features

2.0.0 (2020-04-09)

Bug Fixes

BREAKING CHANGES

    • The .ndjson, .stream and .iterator methods have been removed
  • An .ndjson async generator function has been added to the response which does the same thing the .ndjson instance method used to

Old:

for await (const datum of http.ndjson('http://...')) {

}

New:

const response = await http.post('http://...')

for await (const datum of response.ndjson()) {

}

1.2.4 (2020-04-08)

Bug Fixes

  • detect node stream with hasOwnProperty (#33) (1c1d894)

1.2.3 (2020-04-07)

Bug Fixes

  • destroy request body when we are aborting it midway though r… (#31) (1f7506d)

1.2.2 (2020-04-06)

Bug Fixes

  • avoid Identifier 'global' has already been declared (#30) (f468065)

1.2.1 (2020-03-31)

Bug Fixes

1.2.0 (2020-03-31)

Features

1.1.0 (2020-03-26)

Bug Fixes

Features

1.0.0 (2020-03-20)

Features

0.7.2 (2020-02-10)

Bug Fixes

0.7.1 (2020-01-23)

Bug Fixes

0.7.0 (2020-01-23)

Features

  • accept browser readable streams as input (#21) (0902067)

0.6.0 (2020-01-09)

Bug Fixes

0.5.0 (2019-12-06)

Features

  • convert to async iterators (#15) (251eff0)
  • support unixfs metadata and formatting it (#14) (173e4bf)

BREAKING CHANGES

  • In order to support metadata on intermediate directories, globSource in this module will now emit directories and files where previously it only emitted files.
  • Support for Node.js streams and Pull Streams has been removed

0.4.0 (2019-09-19)

Features

0.3.0 (2019-09-15)

Features

0.2.0 (2019-09-06)

Features

0.1.0 (2019-09-04)

Bug Fixes

Features

  • add glob-source from js-ipfs to be shared (#9) (0a95ef8)
  • add normalise input function (#5) (b22b8de), closes #8

0.0.4 (2019-07-18)

Features

  • add globalThis polyfill (f0c7c42)

0.0.3 (2019-05-16)

0.0.2 (2019-05-16)

Bug Fixes