https://github.com/cnych/ipfs-cluster-js-api
https://github.com/cnych/ipfs-cluster-js-api
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cnych/ipfs-cluster-js-api
- Owner: cnych
- License: mit
- Created: 2024-02-23T03:50:47.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-10T03:22:20.000Z (about 1 year ago)
- Last Synced: 2025-02-08T23:45:25.232Z (4 months ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ipfs-cluster-js-api
> A client library for the IPFS Cluster HTTP API, implemented in JavaScript.
**UNOFFICIAL AND ALPHA**
This is a port of `ipfs/js-ipfs-api` adapted for the API exposed by `ipfs/ipfs-cluster`.
## Install
This module can be installed through npm directly from the github repository.
`npm install ipfs-cluster-js-api`
### Dependencies
This module requires `ipfs-cluster` to be running. It is assumed that the IPFS
Cluster API is running on "127.0.0.1:9094".## Usage
To import the module:
```
var ipfsClusterAPI = require('ipfs-cluster-api')
``````
// connect to ipfs-cluster daemon API server (displayed are default values)
var ipfsCluster = ipfsClusterAPI('localhost', 9094, {protocol: 'http'})
```### API
The API is currently a work-in-progress. The exposed methods are designed
to be similar to `ipfs-cluster-ctl` provided in `ipfs/ipfs-cluster`.```
ipfsCluster.id([options], [callback])ipfsCluster.peers.ls([options], [callback])
ipfsCluster.peers.add(addr, [options], [callback]) // e.g. /ip4/1.2.3.4/tcp/1234/
ipfsCluster.peers.rm(peerid, [options], [callback])ipfsCluster.pin.ls([cid], [callback])
ipfsCluster.pin.add(cid, [options], [callback]) // e.g. { "replication_factor": 2 }
ipfsCluster.pin.rm(cid, [options], [callback])ipfsCluster.status([cid], [callback])
ipfsCluster.sync([cid], [callback])
ipfsCluster.recover(cid, [options], [callback])ipfsCluster.version([options], [callback])
```## Maintainer
This is a side project of mine (te0d).
The code is mostly from `js-ipfs-api` modified to consume the `ipfs-cluster` API.
## Contribute
PRs Accepted.
## License
MIT