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

@cdmx/wappler_sc_mime_validator

v0.0.6

Published

Wappler Server Connect module for validating MIME types in S3 workflows. Provides actions for secure file uploads, downloads, and validation with custom S3 providers.

Readme

Wappler Server Connect: MIME Validator

Created and maintained by Lavi Sidana

Overview

This Mime Validator functionality validates the MIME type of a file uploaded via Wappler's Server Connect. It checks whether the uploaded file matches one or more acceptable MIME types, ensures the file is valid by checking its buffer MIME, and provides additional validation for PDF files, detecting embedded JavaScript if requested.

Features

  • Validates MIME types against a list of accepted types (comma-separated).
  • Supports wildcard MIME types (e.g., image/*, application/*, */*).
  • Verifies file buffer MIME type against the file extension.
  • Optionally checks PDF files for embedded JavaScript.
  • Supports both single and multiple file uploads.

Functionality

Mime Validator

Validates the uploaded file's MIME type and ensures the file is safe for use.

Parameters

  • Accepts (required): A comma-separated list of acceptable MIME types. Example: "image/jpeg, image/png".
  • Input Name (required): The name of the file input field in the request.it should be a string e.g input_name[]
  • Detect PDF Scripts: If checked, the extension checks for embedded JavaScript in PDF files.
  • Detect SVG Scripts: If checked, the extension checks for embedded JavaScript in SVG files.
  • Output: Ifchecked, it returns the object described below.

Returns

An object containing the following properties:

  • is_valid: A boolean indicating whether the file is valid.
  • message: A message describing the validation result.
  • fileData: The file data object.
  • code: A code representing the validation status (ERR101, ERR102, or 0 for success).

Multiple Mime Validator

Validates the MIME type and content of multiple uploaded files, returning validation results for each file.

Parameters

  • Accepts (required): A comma-separated list of acceptable MIME types. Example: "image/jpeg, image/png".
  • Input Name (required): The name of the file input field in the request (should accept multiple files).
  • Detect PDF Scripts: If checked, the extension checks for embedded JavaScript in PDF files.
  • Detect SVG Scripts: If checked, the extension checks for embedded JavaScript in SVG files.
  • Output: Ifchecked, it returns the object described below.

Returns

An object containing the following properties:

  • is_valid: A boolean indicating whether all files are valid.
  • message: A message describing the overall validation result.
  • filesData: An array of objects, each representing the validation result for a file. Each object contains:
    • is_valid: Boolean for that file
    • message: Validation message for that file
    • code: Status code for that file
    • filesData: Array with a single file data object (name, size, encoding, mimetype, md5, truncated)
  • code: A code representing the overall validation status (ERR101, ERR102, ERR103, or 0 for success)

Example Output

{
  "is_valid": true,
  "message": "All files validated successfully",
  "code": 0,
  "filesData": [
    {
      "is_valid": true,
      "message": "File validation successful",
      "code": 0,
      "fileData": [
        {
          "name": "file1.pdf",
          "size": 12345,
          "encoding": "7bit",
          "mimetype": "application/pdf",
          "md5": "abc123...",
          "sha256": "28505cfe...",
          "truncated": false
        }
      ]
    },
    {
      "is_valid": false,
      "message": "File type not allowed (content).",
      "code": "ERR101",
      "fileData": [
        {
          "name": "file2.exe",
          "size": 54321,
          "encoding": "7bit",
          "mimetype": "application/x-msdownload",
          "md5": "def456...",
          "sha256": "28505cfe...",
          "truncated": false
        }
      ]
    }
  ]
}

Error Codes

  • ERR101: File type not allowed or file missing.
  • ERR102: PDF file contains embedded JavaScript.
  • ERR103: SVG file contains embedded JavaScript.

Known Issues (Docker)

Error:

Error: /bin/sh: 1: file: not found

Solution: Add the following to your Dockerfile to install the required file utility:

RUN apt-get update && apt-get install -y file