@akashaproject/ipfs-connector
TypeScript icon, indicating that this package has built-in type declarations

1.11.5 • Public • Published

ipfs-connector

Build Status Coverage Status npm Known Vulnerabilities

Library for solving the cross-platform binaries problem (works on Windows as well) containing helpers for easier read/write on IPFS by extending the JavaScript IPFS API functionality.

Some of the differences:

  • Able to specify init folder
  • Promised based, no callbacks
  • Connector can be accessed from anywhere inside the app as it is a singleton
  • Plug your favorite logging library (by default console). See tests folder

For more information please see the API docs

Installation

npm install @akashaproject/ipfs-connector --save

Usage

import { IpfsConnector } from '@akashaproject/ipfs-connector';

const instance = IpfsConnector.getInstance();

// start ipfs daemon and download binaries if needed
instance.start().then((api) => {});

// stop daemon
instance.stop()

// see api docs
// add/get data to ipfs
// cid zdpuB2CAUgUbyJ4s8SmqcGGaGfs7bG337dDNty8NSCR3fhgRw
const cid = instance.api.add({firstName: 'John', lastName: 'Doe'});
//returns John
instance.api.get(cid, '/firstName'); 

// read data from ipfs
instance.api.ipfsApi.cat('ipfs hash')

// access default ipfs-http-api from
instance.api.ipfsApi

Dev

git clone https://github.com/AkashaProject/ipfs-connector.git
cd ipfs-connector

// install dependencies
npm install

// run tests
npm test

// generate docs
npm run docs

CHANGELOG

LICENSE

Readme

Keywords

Package Sidebar

Install

npm i @akashaproject/ipfs-connector

Weekly Downloads

3

Version

1.11.5

License

MPL-2.0

Unpacked Size

75.8 kB

Total Files

17

Last publish

Collaborators

  • mariusdarila
  • mihaialisie