CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-supabase--supabase-js

Isomorphic JavaScript client for Supabase providing authentication, database, real-time, storage, and edge functions capabilities.

89

0.95x
Overview
Eval results
Files

task.mdevals/scenario-6/

Storage File Browser

Build a file browser utility that retrieves and displays files from a Supabase storage bucket with support for pagination and folder navigation.

Capabilities

List files in a bucket

  • When given a bucket name, it retrieves all files at the root level of that bucket. @test
  • When given a bucket name and a folder path, it retrieves all files within that specific folder. @test

Handle pagination

  • When the bucket has more than 100 files, it retrieves the first 100 files and provides a way to fetch the next page. @test
  • When given a pagination cursor, it retrieves the next page of results starting from that cursor. @test

Search files by prefix

  • When given a search prefix, it returns only files whose names start with that prefix. @test

Implementation

@generates

API

/**
 * Configuration for the file browser
 */
export interface FileBrowserConfig {
  supabaseUrl: string;
  supabaseKey: string;
  bucketName: string;
}

/**
 * Options for listing files
 */
export interface ListOptions {
  folderPath?: string;
  limit?: number;
  cursor?: string;
  searchPrefix?: string;
}

/**
 * Result from listing files
 */
export interface ListResult {
  files: Array<{
    name: string;
    id: string;
    updated_at: string;
    created_at: string;
    last_accessed_at: string;
    metadata: Record<string, any>;
  }>;
  nextCursor?: string;
  hasMore: boolean;
}

/**
 * FileBrowser provides functionality to browse and list files in a Supabase storage bucket
 */
export class FileBrowser {
  /**
   * Creates a new FileBrowser instance
   * @param config Configuration object containing Supabase credentials and bucket name
   */
  constructor(config: FileBrowserConfig);

  /**
   * Lists files in the bucket with optional filtering and pagination
   * @param options Options for customizing the file listing
   * @returns A promise that resolves to the list of files and pagination information
   */
  listFiles(options?: ListOptions): Promise<ListResult>;
}

Dependencies { .dependencies }

@supabase/supabase-js { .dependency }

Provides storage client functionality for interacting with Supabase buckets.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-supabase--supabase-js

tile.json