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

@veap/storage

v0.1.6

Published

File storage service and local driver for Veap

Downloads

668

Readme

CI Release Version

@veap/storage

Unified file storage abstraction supporting local filesystem and cloud object storage providers for Veap and Next.js applications.

Overview

@veap/storage simplifies file uploads, media management, and asset delivery. It abstracts physical disk storage and cloud bucket drivers behind a consistent StorageService API. It includes filename sanitization, automatic MIME-type and extension validation, deduplication hashing, and driver routing.

Features

  • Multi-driver architecture: Pluggable StorageProvider interface allowing concurrent drivers (for example, local disk for uploads, S3 for archives).
  • Default local provider: Ready-to-use LocalFileProvider saving files to configurable public or private application directories.
  • Security & validation: Built-in file extension sanitization, MIME-type checks, and path traversal protection.
  • Clean IoC integration: StorageServiceProvider automatically registers the default provider and binds StorageService into the kernel container.
  • Next.js & standard web File support: Works seamlessly with web standard File and FormData objects from Server Actions and Route Handlers.

Installation

# Using bun
bun add @veap/storage @veap/kernel

# Using pnpm
pnpm add @veap/storage @veap/kernel

# Using npm
npm install @veap/storage @veap/kernel

Configuration

Configure the local storage directory using environment variables or ConfigService:

| Environment Variable | Description | Default | | --------------------- | -------------------------------------- | ---------------- | | FILE_STORAGE_FOLDER | Destination folder on disk for uploads | public/uploads |

Usage

Register in Application Builder

Include StorageServiceProvider in your application composition root:

import { Application } from "@veap/kernel";
import { StorageServiceProvider } from "@veap/storage";

export const app = Application.configure().use(StorageServiceProvider).create();

Handling Uploads in Next.js Server Actions

Upload files directly from forms using StorageService resolved via IoC:

"use server";

import { app } from "@veap/kernel";
import { StorageService } from "@veap/storage";

export async function uploadAvatar(formData: FormData) {
  const file = formData.get("avatar") as File;
  if (!file) {
    throw new Error("No file provided");
  }

  const storage = await app(StorageService);
  const result = await storage.upload(file, "local");

  if ("error" in result) {
    throw new Error(result.error);
  }

  return { url: result.url, path: result.path };
}

Implementing a Custom Storage Driver

Create custom cloud storage drivers (for example, AWS S3 or Cloudflare R2) by implementing the StorageProvider interface:

import type { StorageProvider, StorageFile, UploadResult } from "@veap/storage";

export class S3StorageProvider implements StorageProvider {
  public id = "s3";

  async upload(file: StorageFile): Promise<UploadResult> {
    // Perform upload to S3 bucket
    return {
      url: `https://my-bucket.s3.amazonaws.com/${file.name}`,
      path: `uploads/${file.name}`,
    };
  }

  async delete(filePath: string): Promise<boolean> {
    // Delete file from S3 bucket
    return true;
  }
}

Subpath Exports

| Export Path | Content | | --------------- | -------------------------------------------------------------------------- | | @veap/storage | StorageService, StorageServiceProvider, LocalFileProvider, and types |

Documentation

For full guides and storage driver configuration, visit:

License

MIT