@aragonone/ipfs-pinner-client
This is a client library for integrating into other projects.
Last updated 2 months ago by promaty .
GPL-3.0-or-later · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @aragonone/ipfs-pinner-client 
SYNC missed versions from official npm registry.

Client

This is a client library for integrating into other projects.

Installation

yarn add @aragonone/ipfs-pinner-client

Usage

import client from '@aragonone/ipfs-pinner-client'

// upload and get file metadata
fileMeta = await client.upload(ethAddress, content, fileName)

// get single file
fileMeta = await client.findOne(cid)

// get multiple files
fileMetaPage = await client.findAll(owner, page, pageSize)

// delete IPFS pin and metadata
deleteStatus = await client.delete(cid, signature, timestamp)

For type information see ./src/index.ts

For usage in server integration tests see: ../server/test/integration/file-creation.test.ts

Error handling

import { client, PinnerError } from '@aragonone/ipfs-pinner-client'
try {
  fileMeta = await client.upload(ethAddress, content, fileName)
}
catch (err) {
  if (err instanceof PinnerError) {
    pinnerErrors = err.errors
  }
}

If server is unreachable:

pinnerErrors = [{ endpoint: `Could not connect to endpoint (<MESSAGE>)` }]

Server error responses are documented in ../server

Current Tags

  • 1.0.0                                ...           latest (2 months ago)

3 Versions

  • 1.0.0                                ...           2 months ago
  • 0.0.2                                ...           2 months ago
  • 0.0.1                                ...           2 months ago
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 3
Last Month 0
Dependencies (2)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |