/fleek-ipfs

Primary LanguageTypeScript

Fleek x IPFS Nodejs App

This Node.js application allows you to easily pine files to IPFS using the Fleek SDK.

Prerequisites

Before you begin, make sure you have the following installed:

Getting Started

Follow these steps to get started with the Fleek Node.js App:

  1. Clone this repository:

    git clone https://github.com/geniusyinka/fleek-ipfs.git
  2. Navigate to the project directory:

    cd fleek-ipfs
  3. Install dependencies:

    npm install
  4. Obtain a Personal Access Token (PAT) from Fleek. Replace <your-pat> in the code with your actual PAT.

Usage

Once the application is running, follow these steps to upload a file to IPFS:

  1. Ensure that the file you want to upload is in the project directory.

  2. Update the filename in the code to match the file you want to upload:

    const fileContent = fs.readFileSync('<filename>');
    uploadFileToIPFS('<filename>', fileContent)
      .then(result => {
        console.log('File uploaded to IPFS:', result);
      })
      .catch(error => {
        console.error('Error uploading file to IPFS:', error);
      });
  3. Execute the application:

    npx tsx index.ts
  4. Upon successful execution, you will see a message indicating that the file has been uploaded to IPFS along with the resulting hash.