Update the metadata for an existing file

Usage

import { PinataSDK } from "pinata-web3";

const pinata = new PinataSDK({
  pinataJwt: process.env.PINATA_JWT!,
  pinataGateway: "example-gateway.mypinata.cloud",
});

const update = await pinata.updateMedatadata({
  cid: "bafkreih5aznjvttude6c3wbvqeebb6rlx5wkbzyppv7garjiubll2ceym4",
  name: "Pinnie V2",
  keyValues: {
    whimsey: 200
  }
})

Returns

OK

Parameters

cid

  • Type: string

CID of the file you want to update

const update = await pinata.updateMedatadata({
  cid: "bafkreih5aznjvttude6c3wbvqeebb6rlx5wkbzyppv7garjiubll2ceym4",
  name: "Pinnie V2",
})

name (Optional)

  • Type: string

Update the name of a file that will appear in listFiles

const update = await pinata.updateMedatadata({
  cid: "bafkreih5aznjvttude6c3wbvqeebb6rlx5wkbzyppv7garjiubll2ceym4",
  name: "Pinnie V2",
})

keyValues (Optional)

  • Type: object

Update the keyValues object for a file

const update = await pinata.updateMedatadata({
  cid: "bafkreih5aznjvttude6c3wbvqeebb6rlx5wkbzyppv7garjiubll2ceym4",
  keyValues: {
    whimsey: 200
  }
})