Skip to content

A module for utilizing IPFS p2p filesystem with NestJS

Notifications You must be signed in to change notification settings

mfcodeworks/nestjs-ipfs

Repository files navigation

Nest Logo

A Module for Utilizing IPFS P2P File System with NestJS

License npm version Built with NestJS

Description

IPFS implementation module for NestJS

Installation

npm i @mfsoftworks/nestjs-ipfs

Quick Start

Import the IPFS module

import { IpfsModule } from '@mfsoftworks/nestjs-ipfs';

IPFS module supports registering using defaults, or a static object

@Module({
  imports: [IpfsModule.register()],
  providers: [AppService],
})
export class AppModule {}

IPFS module supports async registration with useClass, useExisting, including a createIPFSOptions function; or a custom useFactory

@Module({
  imports: [IpfsModule.registerAsync({
    useClass: ConfigService
  })],
  providers: [AppService],
})
export class AppModule {}

Wait for Node

IPFS module supports immediate start by default, as well as an optional waitForNode passed as a second parameter to wait for IPFS node initialisation before bootstrap proceeds.

@Module({
  imports: [IpfsModule.register({}, true)],
  providers: [AppService],
})
export class AppModule {}

Usage

getNode() - Call getNode to return the IPFS node. If it's been called previously, or waitForNode is true it will return the cached IPFS node object.

Currently this module is a basic Nest implementation of js-ipfs, any use of the node will need to be done by your business code.

Future usage can be suggested or contribute your own pull request to extend the functionality of this module further.

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

@mfsoftworks/nestjs-ipfs is MIT licensed.