Filebase NPM Package

Learn how to use the Filebase NPM package for pinning files to IPFS.

What is the Filebase NPM package?

The Filebase NPM package is a client library for the https://filebase.com/ service. It provides a convenient interface for working with the Raw HTTP API from a web browser or Node.js and comes bundled with TS for out-of-the box type inference and better IntelliSense.

Read below to learn how to use the Filebase NPM package for pinning files to IPFS.

Prerequisites:

Installing the Filebase npm package

Install the package using npm:

npm i @filebase/client

Or install the package using yarn:

yarn add @filebase/client

Pinning New Files

Replace the following values to reflect your configuration:

  • API Token: Your Filebase API Token. You can learn how to obtain this value here.

  • Name: Your file name.

  • Description: Your file description

  • example.jpg: The name of the file to be pinned.

Alternatively, you can pass text content directly in the script to be uploaded as a new file:

Running the Script

node index.js

The output will resemble the following:

Last updated

Was this helpful?