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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ipfs-get

v2.1.0

Published

Get and verify a file by CID from an IPFS gateway over http.

Readme

ipfs-get 📡✨

Get and verify a file by CID from an IPFS gateway over http.

$ ipfs-get bafybeidd2gyhagleh47qeg77xqndy2qy3yzn4vkxmk775bg2t5lpuy7pcu/youareanonsense.jpg
📡 Resolving CID from https://ipfs.io/
🎯 bafkreiaqv66m5nd6mwgkk7h5lwqnjzj54s4f7knmnrjhb7ylzqfg2vdo54
📡 Fetching .car file from https://ipfs.io/
🔐 Verified 1/1 block
✅ Wrote youareanonsense.jpg

A thin wrapper over @ipld/car and unix-fs-exporter. It fetches the content by CID over HTTP from the IPFS gateway as a Content-Addressed Archive (CAR), extacts the cids and blocks, verifying them as it goes, and writes the files to disk.

In go-ipfs v0.9.0, the /api/v0/dag/export endpoint was added to the public gateway api, allowing us to fetch content as CAR file.

Before that API was available folks just did an http get to /ipfs/, and either trusted the gateway, or optimistically tried to re-add the response to a local ipfs node to check it hashed to the same CID, which is error prone; if any non-default flags were used when adding the content, then the CID you get when adding locally would not match unless you knew ahead of time to use the same flags.

By using car files, the CIDs for the blocks travel with the data, so ipfs-get is able to verify them, regardless of how the DAG was created (well, it only supports sha256 verification currently, for dag-pb and dag-cbor, but that covers the vast majority of existing DAGs created via IPFS.)

Usage

Install ipfs-get globally with npm i -g ipfs-get or run it via npx npx ipfs-get <cid>

# fetch and verify a file by cid from ipfs.io
ipfs-get bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy

# resolve, fetch and verify a dnslink
ipfs-get /ipns/ipfs.io

# try it out with a local gateway (using go-ipfs v0.9.0)
ipfs-get bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy --gateway http://127.0.0.1:5001

# pick the output filename
ipfs-get bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy --output room-guardian.jpg

How

  • Fetch a .car file for the root CID from /api/v0/dag/export. This could fail if the full dag is unavailable. it's ok.
  • Index the cid and block postions in the car file
  • Start at the root as defined by the car file header
  • Verify each block by hashing the block as you pull it from the car, and compare the hash with the CID. Fail if not matched.
  • Assemble the blocks into the files and write it to disk.