npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

auto-js-ipfs

v2.3.0

Published

Automatically get some IPFS download/upload/pinning functionality based on your environment.

Downloads

1,552

Readme

auto-js-ipfs

Automatically get some IPFS download/upload/pinning functionality based on your environment.

How

  • Detect IPFS support in the global fetch() API (e.g. for Agregore)
  • Or attempt to use the local Kubo Daemon URL that was provided
  • Or Detect a locally running go-ipfs daemon
    • Either default Kubo RPC port (9090)
    • Or detect the Brave browser and it's embedded daemon
  • Or use web3.storage (if an auth token is provided)
  • Or use estuary (if an auth token is provided)
  • Or use readonly mode (if enabled)
  • Or throw an error

API

opts => {daemonURL, web3StorageToken, estuaryToken, publicGatewayURL}

These options can be used to either detect what the best supported options are, or to create an instance of this API.

All options are optional, and by default just the local node/agregore support will be used.

daemonURL is the URL of an IPFS daemon that should be used.

web3StorageToken is the Authorization token for use in the web3.storage API.

web3StorageURL is the web3.storage API server URL that should be used.

estuaryToken is the Authorization token for use in the Estuary API.

estuaryURL is the Estuary API server URL that should be used.

publicGatewayURL is the public IPFS gateway to use for loading content without a local node.

readonly is an option for whether there should be a fallback to "readonly" mode where only api.get and api.getSize will be supported. Enabled by default.

async detect(opts) => Promise<[{type, url?}]>

Detect what's supported in the current environment.

type can be one of daemon, fetch, web3.storage, estuary

url is an optional value that will point to ipfs daemon URL being used or the public gateway being used, or the backend API URL to be used.

async choose(choice) => Promise<API>

Initialize the API based on the choice selected from detect()

async create(opts) => Promise<API>

Create an API instance by auto-detecting the "best" option available.

api.get(url, {start, end, format, signal}) => AsyncIterator<ArrayBuffer>

Get data from an ipfs:// URL, can optionally chose a start and end offset for loading data.

You can also optionally supply the format you want to load the data in. Valid formats are raw for getting raw Blocks from IPFS, and car for downloading a whole tree as a CAR (Content ARchive) file.

api.getSize(url, signal) => Promise<Number>

Get info about the size of a file at a URL.

api.uploadCar(carFileAsyncIterator, signal) => Promise<[url]>

Upload a CAR file. Returns an array of root ipfs:// URLs

api.uploadFile(fileAsyncIterator, fileName?, signal) => Promise<url>

Upload a file to the backend and get back a URL. Optionally specify a file name so that it will be wrapped in a folder.

api.clear(url, signal?) => Promise

Clear a URL that was previously downloaded and it's child nodes. This works by unpinning data when in kubo, removing it from the list in web3.storage, or deleting it from cache in Agregore.