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

@pompelmi/remix

v1.0.0

Published

Remix upload handler for pompelmi — in-process ClamAV virus scanning with zero extra dependencies

Readme

@pompelmi/remix

Remix upload handler for pompelmi — in-process ClamAV virus scanning with zero extra dependencies.

Works with Remix v1 and v2 on Node.js, and is compatible with the unstable_parseMultipartFormData API.

Installation

npm install @pompelmi/remix pompelmi

Quick Start

import { unstable_parseMultipartFormData, json } from '@remix-run/node'
import { pompelmiUploadHandler } from '@pompelmi/remix'
import type { ActionFunctionArgs } from '@remix-run/node'

export async function action({ request }: ActionFunctionArgs) {
  const formData = await unstable_parseMultipartFormData(
    request,
    pompelmiUploadHandler({ host: 'localhost', port: 3310 })
  )

  const file = formData.get('file') as File
  return json({ name: file.name, size: file.size, ok: true })
}

If a malicious file is uploaded, pompelmiUploadHandler throws a Response with HTTP 422 — Remix catches it automatically and returns it to the client.

With an inner handler

Chain with any Remix upload handler (e.g. unstable_createFileUploadHandler) to store clean files to disk:

import {
  unstable_parseMultipartFormData,
  unstable_createFileUploadHandler,
  json,
} from '@remix-run/node'
import { pompelmiUploadHandler } from '@pompelmi/remix'

const uploadToTmp = unstable_createFileUploadHandler({ directory: '/tmp/uploads' })

export async function action({ request }) {
  const formData = await unstable_parseMultipartFormData(
    request,
    pompelmiUploadHandler({
      host: 'localhost',
      port: 3310,
      inner: uploadToTmp,   // called only if file is clean
    })
  )
  const file = formData.get('file')  // NodeOnDiskFile from inner handler
  return json({ ok: true })
}

Scan a specific field only

Use field to restrict scanning to a single form field. Other file fields are passed through to inner (or returned as File objects) without scanning:

pompelmiUploadHandler({
  host: 'localhost',
  port: 3310,
  field: 'avatar',  // only scan the 'avatar' field
})

Custom error response

pompelmiUploadHandler({
  host: 'localhost',
  port: 3310,
  onInfected: ({ filename }) => {
    console.warn(`Blocked malicious upload: ${filename}`)
    throw new Response(
      JSON.stringify({ error: 'Malware detected', filename }),
      { status: 422, headers: { 'Content-Type': 'application/json' } }
    )
  },
})

Route example (full)

// app/routes/upload.tsx
import {
  unstable_parseMultipartFormData,
  json,
  type ActionFunctionArgs,
} from '@remix-run/node'
import { Form, useActionData } from '@remix-run/react'
import { pompelmiUploadHandler } from '@pompelmi/remix'

export async function action({ request }: ActionFunctionArgs) {
  // Throws HTTP 422 automatically if malware is detected
  const formData = await unstable_parseMultipartFormData(
    request,
    pompelmiUploadHandler({ host: 'localhost', port: 3310 })
  )

  const file = formData.get('document') as File
  if (!file) return json({ error: 'No file provided' }, { status: 400 })

  return json({ name: file.name, size: file.size, ok: true })
}

export default function Upload() {
  const data = useActionData<typeof action>()
  return (
    <Form method="post" encType="multipart/form-data">
      <input type="file" name="document" />
      <button type="submit">Upload</button>
      {data?.ok && <p>Uploaded: {data.name} ({data.size} bytes)</p>}
    </Form>
  )
}

Configuration Reference

| Option | Type | Default | Description | |--------|------|---------|-------------| | field | string | — | Only scan this field; others pass through unscanned | | inner | UploadHandler | — | Inner handler for clean files (e.g. file-upload, memory) | | host | string | — | clamd hostname (enables TCP mode) | | port | number | 3310 | clamd port | | socket | string | — | UNIX domain socket path | | timeout | number | 15000 | Socket idle timeout in ms | | retries | number | 0 | Retry attempts | | retryDelay | number | 1000 | Delay between retries in ms | | onInfected | Function | — | Called with { name, filename } when malware detected |

License

ISC — see root LICENSE.