js-ipfs is an HTTP client library that connects to any IPFS daemon, enabling JavaScript applications to interact with the InterPlanetary File System. It provides a promise-based asynchronous API for managing content-addressed storage, where all data is identified by cryptographic hashes (CIDs) for immutable references and deduplication. The library communicates with a remote IPFS node through HTTP requests, supporting cancellation of in-flight operations via standard AbortController signals.
The library offers a comprehensive set of capabilities for working with IPFS, including adding and retrieving content by CID, managing a mutable filesystem with standard read/write/delete operations, and pinning content for permanent storage. It supports peer-to-peer file sharing through a distributed hash table (DHT) for peer discovery and content routing, as well as real-time pub/sub messaging over libp2p for topic-based communication between peers. Users can also publish and resolve IPNS names to create human-readable references to content-addressed data.
Additional functionality includes managing node configuration, monitoring node statistics such as bandwidth usage and repository stats, and querying the DHT to find peers or store key-value pairs. The library supports streaming data transfer for large files, allowing incremental processing without loading entire payloads into memory.