Gateways
get
Retrieve a file through the config’s pinataGateway
Usage
import { PinataSDK } from "pinata";
const pinata = new PinataSDK({
pinataJwt: process.env.PINATA_JWT!,
pinataGateway: "example-gateway.mypinata.cloud",
});
const file = await pinata.gateways.get("QmVLwvmGehsrNEvhcCnnsw5RQNseohgEkFNN1848zNzdng")
Returns
Returns the data in the form of JSON
, string
, or Blob
as well as the ContentType
type GetCIDResponse = {
data?: JSON | string | Blob | null;
contentType: ContentType;
};
type ContentType =
| "application/json"
| "application/xml"
| "text/plain"
| "text/html"
| "text/css"
| "text/javascript"
| "application/javascript"
| "image/jpeg"
| "image/png"
| "image/gif"
| "image/svg+xml"
| "audio/mpeg"
| "audio/ogg"
| "video/mp4"
| "application/pdf"
| "application/octet-stream"
| string;
Parameters
cid
- Type:
string
Accepts CID of the file you are trying to fetch
const data = await pinata.gateways.get(
"bafybeibo5zcqeorhqxczodrx52rn7byyrwfvwthz5dspnjlbkd7zkugefi",
);