JS-IPFS (opens new window) is a full implementation of IPFS, similar to Go-IPFS (opens new window). You can use it either as a command-line application or as a library to start an IPFS node directly in your program.
The JS-IPFS HTTP client (opens new window) is a smaller library that controls an IPFS node that is already running via its HTTP API. JS-IPFS actually uses this library internally if it detects that another node is already running on your computer. You can also interact with the HTTP API directly using
fetch()in a browser or a module like
requestin Node.js, but using this library can be much more convenient.
Both libraries have the same interface for using all the major IPFS commands (opens new window).
Whenever reasonable, we recommend the second method (interacting with a separate IPFS node via the HTTP API). Keeping the IPFS node in a separate process (even if it’s one your program spawns) isolates you from any stability problems with the node. If a user already has IPFS installed, this also means you can take advantage of a single, common installation on their computer. It’s also less code to load in a browser. If you need to spawn a separate IPFS process, you might want to take a look at
js-ipfsd-ctl (opens new window), which uses the same interface to spawn a Go-IPFS node, a JS-IPFS node, or an in-process JS-IPFS node.
js-ipfs-http-client libraries work in browsers, but each has some special considerations noted in their READMEs.
You may also be interested in the IPFS browser extension, IPFS Companion (opens new window). If a visitor to your site has it installed, it will make a global
js-ipfs-api, but comes with much better security controls and lets you use IPFS without loading any special libraries.
# JS API reference
# HTTP client library
# Hands-on examples
There are lots of JS-IPFS use-case examples in the
ipfs/js-ipfs GitHub repository (opens new window). They're all self-contained projects that let your spin up and test environments quickly. Check them out → (opens new window).
A good starting place is the IPFS 101, spawn a node and add a file to the IPFS network (opens new window).