0.5.1 • Published 3 years ago

@chris.troutner/ipfs-client v0.5.1

Weekly downloads
-
License
(Apache-2.0 OR MI...
Repository
github
Last release
3 years ago

ipfs-client

A client for ipfs daemons

This module combines the ipfs-grpc-client and ipfs-http-client modules to give you a client that is capable of bidirectional streaming in the browser as well as node.

Install

$ npm install ipfs-client

API

The client object created by the createClient function supports the IPFS Core API, see the docs for more.

create([options])

Parameters

None

Options

An optional object which may have the following keys:

NameTypeDefaultDescription
grpcMultiaddr or string or URLundefinedThe address of a ipfs-grpc-server to connect to
httpMultiaddr or string or URLundefinedThe address of a ipfs-http-server to connect to
agenthttp.AgentundefinedA http.Agent used to control HTTP client behaviour (node.js only)

Returns

TypeDescription
objectAn instance of the client

Example

const { create } = require('ipfs-client')

const client = create({
  grpc: '/ipv4/127.0.0.1/tcp/5003/ws',
  http: '/ipv4/127.0.0.1/tcp/5002/http'
})

const id = await client.id()