mcpField
T
tigris-object-operations

tigris-object-operations

github.com/tigrisdataCloud & DevOps23.3k installsUpdated 14w ago
Repository

About tigris-object-operations

A skill for working with Tigris object storage through its CLI and storage package. It covers common object operations, metadata, and presigned URLs, with guidance for browser uploads.

Key features

  1. 01Upload and download objects
  2. 02Delete and list objects
  3. 03Inspect object metadata
  4. 04Generate presigned URLs
  5. 05Configure browser-side uploads

Use cases

  1. 01Uploading files to Tigris storage
  2. 02Listing objects by prefix
  3. 03Downloading objects in string, file, or stream form
  4. 04Creating temporary upload or download URLs

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/tigrisdata/skills --skill tigris-object-operations

After installing, type/tigris-object-operationsin Claude Code to confirm it loaded.

Bundled filesmetadata.jsonREADME.md

Details

From the project README

Tigris Object Operations

Prerequisites

Before doing anything else, install the Tigris CLI if it's not already available:

tigris help || npm install -g @tigrisdata/cli

If you need to install it, tell the user: "I'm installing the Tigris CLI (@tigrisdata/cli) so we can work with Tigris object storage."

Overview

Tigris Storage provides object operations: upload (put), download (get), delete (remove), list, metadata (head), and presigned URLs.

All methods return TigrisStorageResponse<T, E> - check error property first.

Quick Reference

OperationFunctionKey Parameters
Uploadput(path, body, options)path, body, access, contentType
Downloadget(path, format, options)path, format (string/file/stream)
Deleteremove(path, options)path
Listlist(options)prefix, limit, paginationToken
Metadatahead(path, options)path
Presigned URLgetPresignedUrl(path, options)path, operation (get/put)

Upload (put)

import { put } from "@tigrisdata/storage";

// Simple upload
const result = await put("simple.txt", "Hello, World!");
if (result.error) {
  console.error("Error:", result.error);
} else {
  console.log("Uploaded:", result.data?.url);
}

// Large file with progress
const result = await put("large.mp4", fileStream, {
  multipart: true,
  onUploadProgress: ({ loaded, total, percentage }) => {
    console.log(`${loaded}/${total} bytes (${percentage}%)`);
  },
});

// Prevent overwrite
const result = await put("config.json", config, {
  allowOverwrite: false,
});

Put Options

OptionValuesDefaultPurpose
accesspublic/private-Object visibility
addRandomSuffixbooleanfalseAvoid naming collisions
allowOverwritebooleantrueAllow replacing existing
contentTypestringinferredMIME type
contentDispositioninline/attachmentinlineDownload behavior
multipartbooleanfalseEnable for large files
onUploadProgresscallback-Track upload progress

Download (get)

import { get } from "@tigrisdata/storage";

// Get as string
const result = await get("object.txt", "string");
if (result.error) {
  console.error("Error:", result.error);
} else {
  console.log("Content:", result.data);
}

// Get as file (triggers download in browser)
const result = await get("object.pdf", "file", {
  contentDisposition: "attachment",
});

// Get as stream
const result = await get("video.mp4", "stream");
const reader = result.data?.getReader();
// Process stream...

Get Options

OptionValuesDefaultPurpose
contentDispositioninline/attachmentinlineDownload behavior
contentTypestringfrom uploadMIME type
encodingstringutf-8Text encoding
snapshotVersionstring-Read from snapshot

Delete (remove)

import { remove } from "@tigrisdata/storage";

const result = await remove("object.txt");
if (result.error) {
  console.error("Error:", result.error);
} else {
  console.log("Deleted successfully");
}

List Objects

import { list } from "@tigrisdata/storage";

// List all objects
const result = await list();
console.log("Objects:", result.data?.items);

// List with prefix (folders)
const result = await list({ prefix: "images/" });

// List with pagination
const allFiles = [];
let currentPage = await list({ limit: 10 });
allFiles.push(...currentPage.data?.items);

while (currentPage.data?.hasMore) {
  currentPage = await list({
    limit: 10,
    paginationToken: currentPage.data?.paginationToken,
  });
  allFiles.push(...currentPage.data?.items);
}

List Options

OptionPurpose
prefixFilter keys starting with prefix
delimiterGroup keys (e.g., '/' for folders)
limitMax objects to return (default: 100)
paginationTokenContinue from previous list
snapshotVersionList from snapshot

Object Metadata (head)

import { head } from "@tigrisdata/storage";

const result = await head("object.txt");
if (result.error) {
  console.error("Error:", result.error);
} else {
  console.log("Metadata:", result.data);
  // { path, size, contentType, modified, url, contentDisposition }
}

Presigned URLs

import { getPresignedUrl } from "@tigrisdata/storage";

// Presigned URL for GET (temporary access)
const result = await getPresignedUrl("object.txt", {
  operation: "get",
  expiresIn: 3600, // 1 hour
});
console.log("URL:", result.data?.url);

// Presigned URL for PUT (allow client upload)
const result = await getPresignedUrl("upload.txt", {
  operation: "put",
  expiresIn: 600, // 10 minutes
});

Presigned URL Options

OptionValuesDefaultPurpose
operationget/put-URL purpose
expiresInseconds3600URL expiration
contentTypestring-Require for PUT

Common Mistakes

MistakeFix
Not checking error firstAlways check if (result.error) before result.data
Wrong format in get()Use 'string', 'file', or 'stream'
Forgetting multipart: trueEnable for files >100MB
Ignoring paginationUse hasMore and paginationToken

Client-Side Uploads

For browser uploads, use the client package to upload directly to Tigris:

import { upload } from "@tigrisdata/storage/client";

const result = await upload(file.name, file, {
  url: "/api/upload", // Your backend endpoint
  onUploadProgress: ({ percentage }) => {
    console.log(`${percentage}%`);
  },
});

For initial setup, see file-storage.

Comments

Markdown supported