@aragonone/ipfs-pinner-client
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @aragonone/ipfs-pinner-client

Weekly Downloads

1

Version

1.0.1

License

GPL-3.0-or-later

Unpacked Size

9.75 kB

Total Files

7

Last publish

Collaborators

  • sohkai
  • bpierre
  • evalir
  • gabrielg
  • facuspagnuolo
  • promaty