Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Latest commit

 

History

History
56 lines (37 loc) · 1.63 KB

README.md

File metadata and controls

56 lines (37 loc) · 1.63 KB

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.

createClient([options])

Parameters

None

Options

An optional object which may have the following keys:

Name Type Default Description
grpc Multiaddr or string or URL undefined The address of a ipfs-grpc-server to connect to
http Multiaddr or string or URL undefined The address of a ipfs-http-server to connect to
agent http.Agent undefined A http.Agent used to control HTTP client behaviour (node.js only)

Returns

Type Description
object An instance of the client

Example

const createClient = require('ipfs-client')

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

const id = await client.id()