JSPM

  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q89917F
  • License xx

Tinyverse web3storage JavaScript API client

Package Exports

  • @tinyverse.space/web3storage
  • @tinyverse.space/web3storage/service

Readme

tinyverse web3storage

The JavaScript API client for web3storage

Getting started

Install the package using npm

npm install web3storage

or yarn:

yarn add web3storage

See [the getting started docs][w3storage-docs-w3name-getting-started] for more information.

You can also find full API reference documentation for the client at https://tinyverse-web3.github.io/web3storage

Usage

The web3stoage package exposes several "top-level" or module-scoped functions like , , and , along with a few classes like and that are returned from and accepted by the API functions.

In the examples below, the module is imported as Name using the ES module import syntax:

import * as Name from 'web3storage'

If you happen to already have something called Name in scope, you can choose a different identifier when importing, or simply import the functions you need:

import { init } from 'web3storage'

Mutability

web3storage is an implementation of IPFS && FileCoin, which was designed to work with IPFS (the InterPlanetary File System).

Create and xx

With a name and a revision in hand, you're ready to call , which signs the revision with your key and submits it to the web3storage service.

import * as Name from 'web3storage'

const ipfs = await IPFS.init()

⚠️ Note: xxx.

// e.g. /ipfs/bafkreiem4twkqzsq2aj4shbycd4yvoj2cx72vezicletlhi7dijjciqpui

Update

Updating .

await Name.publish(nextRevision, name.key)

xx

xx.

import * as Name from 'web3storage'

Revision Serialization/Deserialization

The current revision for a name may need to be serialized to be stored on disk or transmitted and then deserialized later. Note that revisions are not IPNS records - they carry similar data, but are not signed.

import fs from 'fs'