Deleting Files

This guide will show you how to delete files pinned to IPFS using Filebase. We offer three methods for deleting 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 delete files from 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
});

await objectManager.delete(`delete-object-example`);

API Reference

  • S3_KEY and S3_SECRET: Your Filebase API credentials.

  • objectManager.delete(): Delete the specified file from the bucket.

For more details, refer to the Filebase SDK documentation.

Using the S3 Compatible API

Authentication

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

Deleting a File

You can delete 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',
  Key: 'path/to/your/file',
};

s3.deleteObject(params, (err, data) => {
  if (err) {
    console.error('Error deleting file:', err);
  } else {
    console.log('File deleted successfully:', data);
  }
});

API Reference

  • endpoint: Filebase S3 Compatible API endpoint.

  • Bucket: The name of your S3 bucket.

  • Key: The path of the file to be deleted.

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 delete the files.

  4. Delete Files: Click on the "Delete" button next to the file you wish to remove.

Tips

  • Ensure you have selected the correct files before deleting.

  • Deleted files cannot be recovered, so double-check before confirming.

Last updated