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

@zhuyunjing/file-viewer

v1.0.11

Published

A powerful file preview library for web applications

Readme

file-viewer

A powerful file preview library for web applications

简介

file-viewer 是一个功能强大的文件预览库,支持多种文件格式的在线预览,包括 PDF、图片、视频等。它基于现代 Web 技术构建,提供流畅的预览体验和丰富的交互功能。

特性

  • 📄 PDF 预览:支持 PDF 文件的在线预览,包括缩放、旋转、翻页等功能
  • 🖼️ 图片预览:支持常见图片格式的预览
  • 📋 OFD 预览:支持 OFD 文件的在线预览
  • 🚀 高性能:基于 PDF.js 等成熟技术,提供流畅的预览体验
  • 📱 响应式:适配各种屏幕尺寸
  • 🎨 可定制:支持自定义样式和主题
  • 🔧 易于集成:简单的 API,易于集成到现有项目中

安装

pnpm install file-viewer pdfjs-dist

注意:file-viewer 依赖 pdfjs-dist,需要同时安装。

使用示例

PDF 预览

import { createPdfPreview } from 'file-viewer'

const pdfPreview = createPdfPreview({
  url: '/path/to/file.pdf',
  container: document.getElementById('pdf-container'),
  scale: 'auto',
  showToolbar: true,
  showSidebar: true
})

图片预览

import { createImageViewer } from 'file-viewer'

const imageViewer = createImageViewer({
  images: ['/path/to/image1.jpg', '/path/to/image2.jpg'],
  container: document.getElementById('image-container'),
  mode: 'single',
  objectFit: 'contain'
})

OFD 预览

import { createOfdPreview } from 'file-viewer'

const ofdPreview = createOfdPreview({
  url: '/path/to/file.ofd',
  container: document.getElementById('ofd-container'),
  scale: 'auto',
  showToolbar: true
})

依赖

  • pdfjs-dist: ^4.10.38 - PDF.js 核心库,用于 PDF 文件的渲染

文档

详细文档请访问:文档地址

许可证

MIT