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

@beautinique/backend-multer

v1.0.4

Published

Backend multer middleware for Beautinique project.

Downloads

710

Readme

@beautinique/backend-multer

A validated file-upload middleware for Express, built on top of multer - handles the upload, then checks Multer's own errors plus MIME type and size limits, reporting everything as a single structured error.

Installation

npm install @beautinique/backend-multer

express is a peer dependency - install whichever version your service already uses.

Usage

import { validateMulter } from '@beautinique/backend-multer';

app.post(
  '/products/:id/image',
  validateMulter({ type: 'single', fieldName: 'image' }),
  tryCatch(async (req, res) => {
    // req.file is validated - correct MIME type, within the size limit
    res.success({ data: req.file });
  }),
);

| Option | Default | Description | | ------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------ | | type | (required) | The Multer upload mode: 'single', 'array', 'fields', 'any', or 'none'. | | fieldName | - | Required when type is 'single' or 'array' - the form field to read files from. | | maxCount | Multer's default (Infinity) | Only used with type: 'array' - the max number of files accepted for fieldName. | | fieldsConfig| - | Required when type is 'fields' - { name, maxCount }[], one entry per form field. | | limits | Multer's own defaults | Passed straight through to multer({ limits }) (e.g. fileSize as a hard byte ceiling). | | format | Beautinique's image/video allowlist | Overrides the allowed MIME types per media kind: { IMAGE?, VIDEO?, OTHER? } (each an array of MIME strings). OTHER defaults to none allowed. | | size | Beautinique's image/video defaults | Overrides the max size per media kind, in bytes: { IMAGE?, VIDEO?, OTHER? }. OTHER defaults to 2 MB. |

Uploads always use multer's memoryStorage() - files are available as buffers on req.file/req.files, never written to disk.

Validation runs in two stages, and the first one that fails wins:

  1. Multer's own errors - e.g. LIMIT_FILE_SIZE, LIMIT_UNEXPECTED_FILE, LIMIT_FILE_COUNT - mapped to field/global messages with the appropriate error code (PAYLOAD_TOO_LARGE, BAD_REQUEST, ...).
  2. MIME type and size validation - every uploaded file (as determined by type) is checked against the resolved format/size allowlist, using Beautinique's own @beautinique/shared-constants image/video defaults unless overridden.

Either stage can report multiple field/global errors at once (via @beautinique/backend-classes's ErrorBuilder) before calling next(error) once, so a single response can list every problem with the request instead of failing on just the first one found.

Repository

https://github.com/Nageshwar1997/BQ-Packages

Homepage

https://github.com/Nageshwar1997/BQ-Packages

Issues

https://github.com/Nageshwar1997/BQ-Packages/issues

Author

Nageshwar Pawar

License

This package is licensed under the MIT License. See the root LICENSE file for details.