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

@bubblystorage/express

v1.0.0

Published

Express.js middleware and helpers for Bubbly Storage file uploads

Readme

@bubblystorage/express

Express.js middleware and helpers for Bubbly Storage file uploads.

Installation

npm install @bubblystorage/express express multer

Usage

Basic Setup

import express from 'express';
import { createBubblyStorageHandler } from '@bubblystorage/express';

const app = express();

const uploadHandler = createBubblyStorageHandler({
  apiKey: 'your-api-key',
  apiUrl: 'https://your-bubbly-storage-api.com/api/v1', // optional, defaults to production
  maxFileSize: 10 * 1024 * 1024, // 10MB, optional
  allowedTypes: ['image/*', 'application/pdf'], // optional
  fieldName: 'files', // optional, defaults to 'files'
  maxFiles: 10 // optional, defaults to 10
});

// Use as middleware
app.post('/upload', uploadHandler, (req, res) => {
  // Files have been uploaded and processed
  res.json({ message: 'Upload successful' });
});

Single File Upload

import { createBubblyStorageSingleHandler } from '@bubblystorage/express';

const singleUploadHandler = createBubblyStorageSingleHandler({
  apiKey: 'your-api-key',
  fieldName: 'file' // optional, defaults to 'file'
});

app.post('/upload-single', singleUploadHandler, (req, res) => {
  res.json({ message: 'Single file upload successful' });
});

Custom Error Handling

app.post('/upload', uploadHandler, (req, res) => {
  // The middleware handles errors automatically
  // Success responses contain the upload result from Bubbly Storage API
});

API Reference

createBubblyStorageHandler(options)

Creates Express middleware for handling multiple file uploads.

Options

  • apiKey (string, required): Your Bubbly Storage API key
  • apiUrl (string, optional): API endpoint URL, defaults to production
  • maxFileSize (number, optional): Maximum file size in bytes, defaults to 10MB
  • allowedTypes (string[], optional): Array of allowed MIME types (supports wildcards like 'image/*')
  • fieldName (string, optional): Form field name for files, defaults to 'files'
  • maxFiles (number, optional): Maximum number of files, defaults to 10

Returns

Express middleware function that:

  1. Parses multipart/form-data using multer
  2. Validates files (type and size)
  3. Uploads files to Bubbly Storage API
  4. Returns JSON response with upload results

createBubblyStorageSingleHandler(options)

Creates Express middleware for handling single file uploads.

Same options as createBubblyStorageHandler but fieldName defaults to 'file' and maxFiles is ignored.

Error Handling

The middleware automatically handles and returns appropriate HTTP status codes:

  • 400 Bad Request: No files uploaded, invalid file types
  • 413 Payload Too Large: File size exceeds limit
  • 500 Internal Server Error: API errors or server issues

Error responses include a JSON object with success: false and an error message.

Response Format

Successful uploads return:

{
  "success": true,
  "data": {
    // Bubbly Storage API response
  }
}

Requirements

  • Node.js 14+
  • Express 4+
  • Multer 1.4+