1.2.1 • Published 2 years ago

angular-ipfs-service v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

AngularIpfsService

Wrapper service of ipfs-core for Angular application.

This library was generated with Angular CLI version 11.1.1.

Installation

$ npm install angular-ipfs-service

Features

Start Ipfs node and inject to your application.

Methods

AngularIpfsService.start([options])

Start Ipfs node.

Returns

Promise<void>

options

options of IPFS.crate

AngularIpfsService.get()

Get Ipfs Instance.

Returns

Promise<IPFS>

API of IPFS

IPFS Core API

Application setting

custom-webpack setting

Using custom webpack config is recommened in order to provide more better node polyfills.

// extra-webpack.config.ts
import { Configuration, ProvidePlugin } from 'webpack';
import NodePolyfillPlugin from 'node-polyfill-webpack-plugin';

export default {
  plugins: [
    new NodePolyfillPlugin(),
    new ProvidePlugin({
      // eslint-disable-next-line @typescript-eslint/naming-convention
      Buffer: ['buffer', 'Buffer'],
      global: ['global'],
      process: 'process/browser',
    }),
  ],
} as Configuration;

tsconfig.json

  • Sorry, "strict" mode is not supported now.
  • Set the "skipLibCheck" to "true".
  • Set the "allowSyntheticDefaultImports" to true.
  • Set stream path to stream-browserify as follow.
  "compilerOptions": {
    "skipLibCheck": true,
    "allowSyntheticDefaultImports": true,
    "paths": {
      "stream": [
        "node_modules/stream-browserify"
      ]
    }
  }