WEB3.STORAGE

Dive into the specifics of connecting and using WEB3.STORAGE with web3stash

Initialization

To use WEB3.STORAGE you have to pass "WEB3.STORAGE" as the service name. No other name will work!

const web3storageService = Web3Stash("WEB3.STORAGE",{token:""},{web3storage APIconfig options})

Configuration

To use web3storage in web3stash, you need one thing:

  • token - API token generated from the web3storage dashboard

Note: Use these names only while passing keys in object i.e, {token:"",}

Optional Config Options

You can pass config options that are available with web3storage service- You can check web3storage docs to check what config options are there that you can pass while initializing web3storage

Methods Available

The following methods are available for this service, More will be added soon

  • Uploading Json data

web3storageService.uploadJson({name:"example", url:"abc.com"}, {web3storageOptions}).then().catch()
  • Uploading Image

web3storageService.uploadImage("./image.png", {web3storageOptions}).then().catch()
  • Uploading Video

web3storageService.uploadVideo("./video.mp4", {web3storageOptions}).then().catch()
  • Uploading File

web3storageService.uploadFile("./data.txt", {web3storageOptions}).then().catch()

Output

All the functions return id (cid) and metadata (data returned by the service on upload)

{id:"dewfnlpweurmwknrwiojhgcbxczz", metadata:{}}

Last updated