gapi-ipfs-daemon

Downloads
303
Stars
0
Committers
1

@Gapi Ipfs Daemon (Beta)

More information about IPFS system can be find here IPFS-WIKI
For questions/issues you can write ticket here
This module is intended to be used with GAPI or RXDI

Installation and basic examples:

To install this Gapi module, run:
$ npm install @gapi/ipfs-daemon --save

Consuming @gapi/ipfs-daemon

Without configuration

Import inside AppModule or CoreModule

import { Module } from '@rxdi/core';
import { IpfsDaemonModule } from '@gapi/ipfs-daemon';

@Module({
    imports: [
        IpfsDaemonModule.forRoot(),
    ]
})
export class CoreModule { }

Default Gateway port: 8080; Default Api port: 5001;

options can be passed

IpfsDaemonModule.forRoot({
    remote: true | false,
    type: 'js' | 'go' | 'proc',
    config: {
        Addresses: {
            API: '/ip4/127.0.0.1/tcp/5001',
            Gateway: '/ip4/127.0.0.1/tcp/8080',
            Swarm: [ '/ip4/0.0.0.0/tcp/4001', '/ip6/::/tcp/4001' ]
        }
    }
})

Interact with Ipfs-daemon

note: keep in mind that this is beta testing contribution is appreciated

import { Inject, Service } from '@rxdi/core';
import { IPFS_DAEMON } from '@gapi/ipfs-daemon';

@Service()
export class IpfsTestService {

    constructor(
        @Inject(IPFS_DAEMON) private ipfs: IPFS_DAEMON
    ) {}

}

TODO: Better documentation...

Enjoy ! :)