PinataCloud / Pinata-SDK

Official SDK for the Pinata IPFS service
MIT License
273 stars 67 forks source link

fixed require statement on pinata-sdk.js #134

Closed rommel-pinata closed 1 year ago

rommel-pinata commented 1 year ago

Fixes #133

Jase-Legi commented 1 year ago

we are good now?

rommel-pinata commented 1 year ago

Yes once this is merged and published you should be able to upload. One thing to check is that now you have to create an instance of the class

const pinataSDK = require('@pinata/sdk');
const keys = require("./key");

const pinata = new pinataSDK(keys.apiKey,keys.apiSecret);

async function exec(){
    const result = await pinata.pinFromFS("/Users/rommelberrios/Documents/pinata/Pinata-SDK/pinata.png", {pinataMetadata: {name: "different-name.jpg"}});
    console.log('result', result)
}

exec()
Jase-Legi commented 1 year ago

I saw that it's now instantiated with the "new" statement when I checked the docs this morning, it was failing when I tried to instantiate it like a new class earlier but I'll try once it's live. Btw the original post wasn't mine so I don't know if that person knows, but I had the same issue.

rommel-pinata commented 1 year ago

It seems both faced the same error