1.0.1 • Published 3 years ago

@aragonone/ipfs-pinner-client v1.0.1

Weekly downloads
1
License
GPL-3.0-or-later
Repository
github
Last release
3 years ago

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

1.0.1

3 years ago

1.0.0

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago