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

filepeek

v1.0.0

Published

A Google Drive-style file previewer component for React. Supports images, videos, audio, PDFs, and more with zoom, pan, rotate, and gallery navigation.

Readme

FilePeek

A Google Drive-style file previewer component for React. Supports images, videos, audio, PDFs, documents, and more — with zoom, pan, rotate, and gallery navigation.

npm license

✨ Features

  • 🖼️ Image preview with zoom (Ctrl+scroll), pan (drag), rotate (R key)
  • 🎬 Video preview with native HTML5 controls
  • 🎵 Audio preview with styled player
  • 📄 PDF preview via embedded iframe
  • 📁 Generic fallback with file info and download button
  • ⬅️➡️ Gallery navigation for multi-file preview
  • ⌨️ Keyboard shortcuts (Esc, arrows, Ctrl+/-, R)
  • 🎨 Google Drive-style dark overlay with blur & zoom controls
  • 📦 Zero config — CSS is bundled, just import and use

📦 Installation

npm install filepeek lucide-react

lucide-react is a required peer dependency for icons.

🚀 Quick Start

import { useState } from "react";
import { FilePreviewer, type PreviewFile } from "filepeek";
// CSS is auto-imported from the package

function App() {
  const [open, setOpen] = useState(false);
  const [files, setFiles] = useState<PreviewFile[]>([]);

  const handleImageClick = () => {
    setFiles([
      { url: "https://example.com/photo1.jpg", name: "Photo 1.jpg", size: 2_400_000 },
      { url: "https://example.com/photo2.jpg", name: "Photo 2.jpg", size: 1_800_000 },
    ]);
    setOpen(true);
  };

  return (
    <>
      <button onClick={handleImageClick}>View Photos</button>

      <FilePreviewer
        open={open}
        onClose={() => setOpen(false)}
        files={files}
        initialIndex={0}
      />
    </>
  );
}

📖 API Reference

<FilePreviewer />

| Prop | Type | Default | Description | |------|------|---------|-------------| | open | boolean | — | Whether the previewer is visible | | onClose | () => void | — | Called when the user closes the previewer | | files | PreviewFile[] | — | Array of files to preview | | initialIndex | number | 0 | Index of the initially active file | | onDownload | (file: PreviewFile) => void | auto | Custom download handler | | onPrint | (file: PreviewFile) => void | auto | Custom print handler | | className | string | — | Extra class for the overlay |

PreviewFile

interface PreviewFile {
  url: string;          // File URL
  name?: string;        // Display name
  mimeType?: string;    // MIME type (auto-detected if omitted)
  size?: number;        // File size in bytes
  caption?: string;     // Caption shown below the preview
  thumbnail?: string;   // Optional thumbnail URL
}

useFilePreviewer hook

Advanced usage — access the internal state directly:

import { useFilePreviewer } from "filepeek";

const {
  zoom, zoomIn, zoomOut, resetZoom,
  activeIndex, next, prev,
  rotation, rotateClockwise,
  pan, setPan,
  loading, error,
} = useFilePreviewer(files, initialIndex);

Utility functions

import { detectFileType, formatFileSize, getDisplayName } from "filepeek";

detectFileType({ url: "photo.jpg" }); // "image"
formatFileSize(2_450_000);            // "2.3 MB"
getDisplayName({ url: "/path/to/file.pdf" }); // "file.pdf"

⌨️ Keyboard Shortcuts

| Key | Action | |-----|--------| | Esc | Close previewer | | ← → | Navigate files | | Ctrl + + | Zoom in | | Ctrl + − | Zoom out | | Ctrl + 0 | Reset zoom | | R | Rotate 90° clockwise | | Ctrl + Scroll | Zoom with mouse wheel | | Drag | Pan when zoomed in |

🎨 Supported File Types

| Type | Extensions | Preview | |------|-----------|---------| | Image | jpg, png, gif, webp, svg, avif... | Full preview + zoom/pan/rotate | | Video | mp4, webm, ogg, mov... | HTML5 video player | | Audio | mp3, wav, ogg, flac, aac... | Styled audio player | | PDF | pdf | Embedded iframe viewer | | Document | doc, docx, odt, rtf | File info + download | | Spreadsheet | xls, xlsx, ods, csv | File info + download | | Presentation | ppt, pptx, odp | File info + download | | Code | js, ts, py, java, go... | File info + download | | Other | * | Generic fallback |

📄 License

MIT © Abiral Khadka