This package provides a minimal IPFS client as a NestJS Module.
- TypeScript 100%
| .github/workflows | ||
| src | ||
| test | ||
| .eslintrc.js | ||
| .gitignore | ||
| .prettierrc | ||
| CHANGELOG.md | ||
| docker-compose.yml | ||
| package.json | ||
| pnpm-lock.yaml | ||
| README.md | ||
| test.txt | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
IPFS HTTP module for Nest framework (NestJS)
This package provides a IPFS client as a NestJS Module.
Because the previous IPFS HTTP module has been depreciated, and the replacement kubo-rpc-client is utter madness to work with in CommonJS (kubo-rpc-client is a ESM library, which relies on ipfs-utils which is a CommonJS library), I decided to manually implement the important endpoints.
Here's what's supported:
- add
- get
- cat
- stats/dht
Installation
v0.2.0is using NestJS 9 for legacy reasons.
pnpm install nestjs-ipfs-http
Usage
This module expects a running IPFS daemon.
ipfs daemon
Import
@Module({
imports: [
IpfsHttpModule.registerAsync({
useFactory: () => {
return {
client: {
host: '127.0.0.1',
port: 5001,
},
}
},
}),
],
})
export class AppModule {}
Use
const isOnline = await ipfsHttpService.client.isOnline()
console.log(isOnline) // true
Refer to test/e2e/ipfs.spec.ts for more examples.
Test
pnpm run test