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

@daniellim0510/filebox

v1.0.3

Published

A NextJS library for collecting, validating, and archiving files into a ZIP with virus scanning

Readme

KAMI FileBox

A secure, client-side file collection and archiving library for Next.js applications. Easily collect, validate, scan, and package multiple files into a ZIP archive with a beautiful modal interface.

Features

  • Secure File Validation: Whitelist-based file type validation by extension and MIME type
  • Client-Side Security Scanning: Basic security checks including file signature verification and content scanning
  • Drag & Drop Interface: Intuitive file selection with drag-and-drop support
  • ZIP Archive Creation: Automatic packaging of validated files into a ZIP archive
  • Real-time Status Updates: Visual feedback for validation and scanning progress
  • Toast Notifications: User-friendly notifications for all operations
  • TypeScript Support: Full TypeScript support with comprehensive type definitions
  • Customizable: Configurable file size limits, allowed types, and scanning options
  • Dark Mode Support: Built-in dark mode styling

Development

To run the demo application:

# Install dependencies
npm install

# Run development server
npm run dev

# Build the library
npm run build:lib

# Build the Next.js app
npm run build

Open http://localhost:3000 to see the demo.

Installation

npm install @daniellim0510/filebox
# or
yarn add @daniellim0510/filebox
# or
pnpm add @daniellim0510/filebox

Quick Start

'use client';

import { useState } from 'react';
import { FileBoxModal } from '@daniellim0510/filebox';

export default function MyComponent() {
  const [isOpen, setIsOpen] = useState(false);

  const handleComplete = (zipBlob: Blob, filenames: string[]) => {
    // Handle the created ZIP archive
    console.log('Archive created with files:', filenames);

    // Download the archive
    const url = URL.createObjectURL(zipBlob);
    const link = document.createElement('a');
    link.href = url;
    link.download = 'my-archive.zip';
    link.click();
    URL.revokeObjectURL(url);
  };

  return (
    <>
      <button onClick={() => setIsOpen(true)}>
        Open FileBox
      </button>

      <FileBoxModal
        isOpen={isOpen}
        onClose={() => setIsOpen(false)}
        onComplete={handleComplete}
      />
    </>
  );
}

Supported File Types

Documents

  • PDF (.pdf)
  • Text (.txt)
  • Word (.docx)
  • Excel (.xlsx)
  • PowerPoint (.pptx)
  • HTML (.html)
  • Markdown (.md)
  • JSON (.json)

Images

  • JPEG (.jpg, .jpeg)
  • PNG (.png)
  • GIF (.gif)
  • WebP (.webp)
  • SVG (.svg)
  • BMP (.bmp)
  • HEIF (.heif)

Audio

  • MP3 (.mp3)
  • WAV (.wav)
  • OGG (.ogg)
  • AIFF (.aiff)
  • AAC (.aac)
  • FLAC (.flac)

Video

  • QuickTime (.mov)
  • MP4 (.mp4)
  • AVI (.avi)
  • WMV (.wmv)
  • MKV (.mkv)

Configuration

You can customize FileBox behavior by passing a config prop:

<FileBoxModal
  isOpen={isOpen}
  onClose={onClose}
  onComplete={handleComplete}
  config={{
    maxFileSize: 10 * 1024 * 1024,      // 10MB per file
    maxTotalSize: 50 * 1024 * 1024,     // 50MB total
    maxFiles: 20,                        // Maximum 20 files
    allowedExtensions: ['.pdf', '.jpg'], // Custom allowed extensions
    allowedMimeTypes: ['application/pdf', 'image/jpeg'], // Custom MIME types
    virusScanner: {
      enabled: true,                     // Enable/disable scanning
      apiEndpoint: '/api/scan',          // Custom scan API endpoint
      timeout: 30000,                    // Scan timeout in ms
    },
  }}
/>

API Reference

FileBoxModal Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | isOpen | boolean | Yes | Controls modal visibility | | onClose | () => void | Yes | Callback when modal should close | | onComplete | (zipBlob: Blob, filenames: string[]) => void | Yes | Callback when archive is created | | config | FileBoxConfig | No | Configuration options | | className | string | No | Additional CSS classes |

FileBoxConfig

interface FileBoxConfig {
  maxFileSize?: number;        // Max size per file in bytes (default: 10MB)
  maxTotalSize?: number;       // Max total size in bytes (default: 50MB)
  maxFiles?: number;           // Max number of files (default: unlimited)
  allowedExtensions?: string[]; // Allowed file extensions
  allowedMimeTypes?: string[];  // Allowed MIME types
  virusScanner?: VirusScannerConfig;
}

interface VirusScannerConfig {
  enabled?: boolean;    // Enable scanning (default: true)
  apiEndpoint?: string; // Custom API endpoint for server-side scanning
  timeout?: number;     // Scan timeout in ms (default: 30000)
}

Security Notes

  1. Client-Side Scanning Limitations: The built-in client-side scanning performs basic security checks but is NOT a replacement for proper virus scanning. For production use, integrate with a server-side virus scanner like ClamAV.

  2. File Validation: Always validate files on both client and server side. Never trust client-side validation alone.

  3. MIME Type Spoofing: The library checks both file extensions and MIME types, but determined attackers can still spoof these. Use server-side scanning for critical applications.

  4. File Size Limits: Configure appropriate file size limits to prevent memory issues and DoS attacks.

License

MIT

Author

Daniel Lim

Repository

https://github.com/daniellim051000/kami-filebox

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues and questions, please use the GitHub issue tracker.