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

accel-wave

v1.0.1

Published

File upload solution for Accel Record models with support for local filesystem and cloud storage services like Amazon S3

Downloads

6

Readme

Accel Wave

Accel Wave is a file upload solution written in TypeScript. It seamlessly integrates files with Accel Record models and allows you to store files on the local filesystem or cloud storage services like Amazon S3. The interface is inspired by CarrierWave.

Features

  • File uploads to filesystem and AWS S3
  • Model-based file associations
  • Customizable configuration and overrides
  • Support for signed URLs
  • Upload, download, and delete operations

Installation

npm install accel-wave

Basic Usage

Mounting to Models

Here's a basic example of using Accel Wave with an Accel Record model:

// src/models/profile.ts
import { BaseUploader, mount } from "accel-wave";
import { ApplicationRecord } from "./applicationRecord";

export class ProfileModel extends ApplicationRecord {
  // The file path will be stored in the avatarPath column
  avatar = mount(this, "avatarPath", BaseUploader);
}
// Usage example
const profile = Profile.build({});
profile.avatar.file = new File(["avatar content"], "avatar.png", { type: "image/png" });
profile.save(); // The file is automatically saved

// Getting the URL
const avatarUrl = profile.avatar.url();

// Direct file operations
profile.avatar.store(new File(["new content"], "new-avatar.png"));

// Deletion
profile.avatar.store(null);
// Or
profile.destroy(); // Related files are also deleted when the model is destroyed

Custom Uploaders

You can create your own uploader class to customize behavior:

import { BaseUploader } from "accel-wave";

class AvatarUploader extends BaseUploader {
  // Customize the storage directory
  get storeDir() {
    return "avatars";
  }

  // Change the filename
  get filename() {
    const originalName = super.filename;
    return `${Date.now()}_${originalName}`;
  }
}

// Use in the model
export class ProfileModel extends ApplicationRecord {
  avatar = mount(this, "avatarPath", AvatarUploader);
}

Storage Configuration

By default, files are stored on the local filesystem, but you can also configure S3:

import { configureAccelWave, S3Storage } from "accel-wave";

// Global configuration
configureAccelWave({
  storage: S3Storage,
  storeDir: "uploads",
  s3: {
    region: "ap-northeast-1",
    Bucket: "my-bucket",
    ACL: "public-read",
    // Other S3 configuration options...
  },
});

// Or for a specific uploader instance
const uploader = new BaseUploader({
  storage: S3Storage,
  s3: {
    region: "us-east-1",
    Bucket: "another-bucket",
  },
});

Asset Host Configuration

If you want to serve files using a CDN or custom domain, you can set the assetHost option:

// Set in the global configuration
configureAccelWave({
  assetHost: "https://assets.example.com",
});

// Or for a specific uploader instance
const uploader = new BaseUploader({
  assetHost: "https://cdn.example.com",
});

// Usage example
profile.avatar.url()?.href; // => https://assets.example.com/uploads/avatar.png

When assetHost is set, the url() method will generate URLs using the specified host. This applies even when using other storage options like S3. This allows for efficient file delivery via CDNs or custom domains.

Downloading Files

You can also download files from URLs and save them:

const uploader = new BaseUploader();
uploader.download("https://example.com/image.jpg");
uploader.store();

Creating Custom Storage

To create your own storage class, implement the Storage interface:

import { Config, Storage } from "accel-wave";

export class CustomStorage implements Storage {
  constructor(public config: Config) {}

  store(file: File, identifier: string) {
    // Implement file storage
  }

  retrive(identifier: string): File {
    // Implement file retrieval
  }

  delete(identifier: string) {
    // Implement file deletion
  }

  url(path: string): URL {
    // Generate file URL
  }
}

All methods must use synchronous APIs. S3Storage uses sync-actions to convert asynchronous operations to synchronous ones.