npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tapstack/storage

v0.1.0

Published

Tapstack Storage Client - Official SDK for file storage, uploads, and image optimization

Downloads

158

Readme

@tapstack/storage

Official Tapstack Storage SDK for file uploads, downloads, image optimization, and folder management.

Installation

npm install @tapstack/storage

Quick Start

Node.js / Server-side

import { TapstackStorage } from '@tapstack/storage';

const storage = new TapstackStorage({
  apiUrl: 'https://api.tapstack.com',
  apiKey: 'ts_...',
});

// Upload a file
const file = await storage.upload(buffer, { name: 'photo.jpg' });

// Get public URL
const url = await storage.getPublicUrl(file.id);

Browser / React

import { TapstackStorage, TapstackStorageProvider, useUpload, useFiles } from '@tapstack/storage';

const storage = new TapstackStorage({
  apiUrl: 'https://api.tapstack.com',
  getToken: () => authClient.getToken(),
});

function App() {
  return (
    <TapstackStorageProvider storage={storage}>
      <FileUploader />
    </TapstackStorageProvider>
  );
}

function FileUploader() {
  const { upload, isUploading, progress } = useUpload();
  const { data } = useFiles({ mimeType: 'image/*' });

  const handleUpload = async (e) => {
    const file = e.target.files[0];
    await upload(file, { tags: ['avatar'] });
  };

  return (
    <div>
      <input type="file" onChange={handleUpload} disabled={isUploading} />
      {isUploading && <p>Uploading: {progress?.percent}%</p>}
      {data?.files.map(f => <img key={f.id} src={f.publicUrl} alt={f.name} />)}
    </div>
  );
}

API Reference

TapstackStorage

Constructor

new TapstackStorage(config: TapstackStorageConfig)

| Option | Type | Description | |--------|------|-------------| | apiUrl | string | Base URL of the Tapstack API (required) | | apiKey | string | API key for server-side calls | | getToken | () => string \| Promise<string> | Dynamic token getter for frontend apps | | userToken | string | Static user token | | workspaceId | string | Workspace ID to scope requests | | placeholderUrl | string | Default placeholder image URL | | fetch | typeof fetch | Custom fetch (for SSR/tests) |

File Methods

| Method | Returns | Description | |--------|---------|-------------| | upload(file, options?) | Promise<StorageFile> | Upload a file | | get(fileId) | Promise<StorageFile> | Get file metadata | | list(options?) | Promise<ListFilesResponse> | List files with filtering | | delete(fileId) | Promise<void> | Delete a file | | getPublicUrl(fileId) | Promise<string> | Get public URL | | getSignedUrl(fileId, options?) | Promise<string> | Get signed download URL | | move(fileId, folderId) | Promise<StorageFile> | Move file to folder | | rename(fileId, newName) | Promise<StorageFile> | Rename a file | | copy(fileId, options?) | Promise<StorageFile> | Copy a file | | search(query, options?) | Promise<ListFilesResponse> | Search files | | addTags(fileId, tags) | Promise<StorageFile> | Add tags | | removeTags(fileId, tags) | Promise<StorageFile> | Remove tags | | getUsage() | Promise<StorageUsage> | Get storage usage/quota |

Folder Methods

| Method | Returns | Description | |--------|---------|-------------| | listFolders(parentId?) | Promise<StorageFolder[]> | List folders | | getFolder(folderId) | Promise<StorageFolder> | Get folder | | createFolder(name, options?) | Promise<StorageFolder> | Create folder | | renameFolder(folderId, name) | Promise<StorageFolder> | Rename folder | | moveFolder(folderId, parentId) | Promise<StorageFolder> | Move folder | | deleteFolder(folderId) | Promise<void> | Delete folder |

Image Methods

| Method | Returns | Description | |--------|---------|-------------| | optimizeImage(file, options?) | Promise<OptimizedImage> | Generate optimized image variants |

React Hooks

| Hook | Returns | Description | |------|---------|-------------| | useUpload(defaults?) | { upload, isUploading, progress, error, data, reset } | File upload with progress | | useFile(fileId) | { data, isLoading, error, refetch } | Fetch file metadata | | useFiles(options?) | { data, isLoading, error, refetch } | Fetch file list | | useFileUrl(fileId, options?) | { url, isLoading, error } | Get file URL | | useImageOptimize() | { optimize, isOptimizing, result, error } | Image optimization | | useFolders(parentId?) | { data, isLoading, error, refetch } | Fetch folder list |

Utilities

| Function | Description | |----------|-------------| | buildSrcSet(variants) | Build an HTML srcSet string from image variants | | generateUniqueFileName(name) | Generate a unique file name with UUID |

Migration from @tapstack/db

The FileModule in @tapstack/db is deprecated. Replace:

- import { createClient } from '@tapstack/db';
- const client = createClient({ ... });
- await client.files.upload(file);
+ import { TapstackStorage } from '@tapstack/storage';
+ const storage = new TapstackStorage({ apiUrl: '...', apiKey: '...' });
+ await storage.upload(file);

License

MIT