Back to blog

Announcing the New Pinata IPFS SDK

Announcing the New Pinata IPFS SDK

Steve

Pinata’s mission from the very beginning has been to make IPFS accessible, and that includes striving for a great developer experience. One piece of that story is our SDK, and while it has served its purpose, today’s developer ecosystems have evolved beyond the SDK’s original context. These days it’s much more common to work with the Web API File object instead of local files, as well as use client side uploads instead of being server only. Unfortunately, our SDK didn’t support this flow. When we found ourselves using our API more, we knew things had to change.

This prompted a complete rewrite of the SDK from scratch, focused on how developers work with today’s frameworks. Today, we’re excited to announce the result: a lightweight, flexible, and highly capable Typescript IPFS SDK. As we have replaced old code in our own apps, we’ve seen an almost 50% reduction in the amount of code used compared to using the API directly, along with an amazing developer experience.

Let’s go over some of the big improvements you can find in the new Pinata IPFS SDK.

File Objects and Other Formats

Part of making our SDK more flexible was making file objects the primary types for uploads. With this standard, you can either pass files from a client side input, generated files on the server, or read from a file source.

Beyond just standardizing file objects, the SDK also includes many convenience methods, such as uploading base64 strings and uploading existing URLs.

Client or Server Side Compatibility

The previous SDK used fs from node.js to create read streams from local files, and while this might be fine in some workflows, it can inhibit others. Now the SDK is designed to work in either environment! Even if you want to upload content client side, the SDK has methods for generating temporary API keys and passing them into uploads.

Gateways

For the first time, we are including IPFS Gateway methods in our SDK! When it comes to fetching content from IPFS the SDK will allow any kind of IPFS CID reference and it will return the content type and the content itself.

Additionally, the SDK now has our original ipfs-gateway-tools built-in so that you can convert any IPFS link into one that uses your Pinata Dedicated Gateway.

Try It!

Don’t take my word for it, give the new SDK a try for yourself! Just run npm i pinata and check out our documentation to experience IPFS on a new level.

Happy Pinning!

Subscribe to paid plan image

Share this post:

Stay up to date

Join our newsletter for the latest stories & product updates from the Pinata community.