Pinata

Dive into the specifics of connecting and using pinata with web3stash

Initialization

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

const pinataService = Web3Stash("PINATA",{apiKey:"", apiSecret:""},{pinata options})

Configuration

To use pinata in web3stash, you need two things:

  • apiKey

  • apiSecret

Note: Use these name only while passing keys in object i.e, {apiKey:"", apiSecret:""}

Optional Config Options

There are no optional config options for this service

Methods Available

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

  • Uploading JSON data

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

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

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

pinataService.uploadFile("./data.txt", {pinataOptions}).then().catch()
  • Uploading Images from Stream

pinataService.uploadImageFromStream(readableStream, {pinataOptions}).then().catch()
  • Uploading Video from Stream

pinataService.uploadVideoFromStream(readableStream, {pinataOptions}).then().catch()
  • Uploading File from Stream

pinataService.uploadFileFromStream(readableStream, {pinataOptions}).then().catch()

Output

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

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

Last updated