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

offline-doc-preview

v0.1.2

Published

Offline-first React document preview for PDF, Office (docx/xlsx/pptx), HTML, video, audio, CSV, Markdown, JSON, XML and plain text

Downloads

890

Readme

offline-doc-preview

Two React components (a full-pane reader and a thumbnail tile) that render PDF, Word, Excel, PowerPoint, images, HTML, video, audio, Markdown, JSON, XML, CSV and plain text entirely in the browser, with no external services of any kind. Nothing is uploaded, nothing is converted server-side, and no Office Online / Google Docs viewer is embedded behind the scenes. It works behind a firewall or on an air-gapped machine.

Install

npm install offline-doc-preview

This package doesn't bundle its own copy of React so your app needs to already have React 18 or 19 installed (react and react-dom are listed as peerDependencies, so npm won't install them for you automatically).

The code for each format (PDF, Excel, etc.) is split into its own chunk and only loaded from your app's own bundle the first time that format is actually previewed. This is the same lazy-loading any code-split app already does, not a network call anywhere else. If your app only ever previews Markdown files, the PDF and spreadsheet chunks never get loaded at all.

Usage

import { DocumentPreview } from 'offline-doc-preview'
import 'offline-doc-preview/styles.css'
import workerSrc from 'pdfjs-dist/build/pdf.worker.min.mjs?url'

<DocumentPreview
  url="/files/report.docx"
  mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.document"
  pdf={{ workerSrc }}
/>

For a file listing, DocumentThumbnail takes the same inputs and renders a single representative frame for page 1, slide 1, or the top-left of the first sheet:

import { DocumentThumbnail } from 'offline-doc-preview'

<DocumentThumbnail url="/files/report.docx" fit="cover" pdf={{ workerSrc }} />

The PDF renderer needs a worker and won't guess where one lives, so pass pdf={{ workerSrc }} as shown above (see the main repo README for CJK font and search setup notes).

Formats

| Format | Extensions | | ------ | ---------- | | PDF | .pdf | | Word | .docx | | Excel | .xlsx | | PowerPoint | .pptx | | Images | .png .jpg .jpeg .jfif .gif .webp .avif .bmp .ico .svg | | TIFF | .tif .tiff (Safari only) | | Markdown | .md .markdown .mdown .mkd | | JSON | .json .jsonc .jsonl .ndjson | | XML | .xml .xsd .xsl .xslt .rss .atom | | HTML | .html .htm | | Video | .mp4 .webm .mov .ogv | | Audio | .mp3 .wav .m4a .oga .ogg | | CSV / TSV | .csv .tsv | | Text | .txt .text .log .yaml .yml |

Anything else, including legacy .doc, .xls and .ppt, renders a clear "unsupported format" state with a download link rather than failing.

Links

License

MIT