Listing Files

This guide will show you how to list files pinned to IPFS using Filebase. We offer three methods for listing files: our JavaScript SDK, our S3 Compatible API, and our web application dashboard. Choose the method that best suits your needs.

Using the JavaScript SDK

Installation

First, you need to install the Filebase SDK. You can do this using npm:

npm install @filebase/sdk

Usage

Once you have the SDK installed, you can use it to list files pinned to IPFS. Here’s a simple example to get you started:

import { ObjectManager } from "@filebase/sdk";
const objectManager = new ObjectManager(S3_KEY, S3_SECRET, {
  bucket: bucketName
});

const fileList = await objectManager.list({
  MaxKeys: 1000
});

console.log(fileList);

API Reference

  • S3_KEY and S3_SECRET: Your Filebase API credentials.

  • objectManager.list(): List the files in the specified bucket.

For more details, refer to the Filebase SDK documentation.

Using the S3 Compatible API

Authentication

Before you can start listing files using the S3 Compatible API, you need to authenticate using your API key and secret.

Listing Files

You can list files using standard S3 operations. Here’s an example using the AWS SDK for JavaScript:

const AWS = require('aws-sdk');

const s3 = new AWS.S3({
  endpoint: 'https://s3.filebase.com',
  region: 'us-east-1',
  signatureVersion: 'v4',
  accessKeyId: 'YOUR_API_KEY',
  secretAccessKey: 'YOUR_API_SECRET',
});

const params = {
  Bucket: 'YOUR_BUCKET_NAME',
};

s3.listObjectsV2(params, (err, data) => {
  if (err) {
    console.error('Error listing files:', err);
  } else {
    console.log('Files listed successfully:', data.Contents);
  }
});

API Reference

  • endpoint: Filebase S3 Compatible API endpoint.

  • Bucket: The name of your S3 bucket.

For more details, refer to the Filebase S3 API documentation.

Using the Web Application Dashboard

Step-by-Step Guide

  1. Login: Start by logging into your Filebase account.

  2. Navigate to the Dashboard: Once logged in, navigate to the dashboard.

  3. Select Your Bucket: Choose the bucket from which you want to list the files.

  4. View Files: The files pinned to IPFS will be displayed in the dashboard. You can browse through them as needed.

Last updated