ipfs-http-client-lite is a lightweight JavaScript client library designed to interact with the IPFS HTTP API. Its primary differentiator is its small bundle size, aiming for less than 20KB, making it suitable for resource-constrained browser environments. The current stable version is 0.3.0. Based on its release history, which includes incremental feature additions like MFS commands and pubsub, the project demonstrates an active, albeit not rapid, release cadence. It provides a focused alternative to the more comprehensive `ipfs-http-client` for applications where bundle size and minimal footprint are critical, supporting core IPFS operations such as adding and retrieving files, and interacting with the Mutable File System.
npm install ipfs-http-client-liteVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the IPFS client, add content, retrieve it using `cat`, and interact with the Mutable File System (MFS) by creating a directory and writing/reading a file, including error handling.
Configure your IPFS daemon to allow requests from your frontend's domain. Use `ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://your-frontend-domain.com"]'` and `ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST", "GET"]'`, then restart your daemon.
Ensure your Node.js environment meets the minimum requirement of `Node.js >=10.0.0`. Upgrade Node.js to a supported LTS version.
For maximum stability, especially in production, consider importing the main `IpfsHttpClientLite` factory function. If specific method imports are critical for bundle size, pin the `ipfs-http-client-lite` version explicitly in your `package.json` to prevent unexpected changes.
Verify your IPFS daemon is running with `ipfs daemon` and its API port is correctly configured (default is 5001). Check `ipfs config Addresses.API` and update it if necessary, then restart the daemon.
Configure the IPFS daemon's CORS settings: `ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://localhost:3000", "http://127.0.0.1:3000"]'` and `ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST", "GET"]'`. Remember to restart the IPFS daemon after making configuration changes.
Start your IPFS daemon using `ipfs daemon`. If it's already running, verify its API address and port with `ipfs config Addresses.API` and ensure it matches the `apiUrl` configured in your `IpfsHttpClientLite` client.
Ensure you are using the correct method signature. `ipfs.add` expects `Buffer`, `Uint8Array`, or `ReadableStream` as input. If you imported specific methods, ensure `add` was among them and correctly aliased, or use the `IpfsHttpClientLite` factory function which returns an object with all available API methods.
No dependency data recorded yet.