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

@flyfish-group/file-viewer-web

v3.0.0

Published

Private-deploy pure web component for File Viewer

Readme

@flyfish-group/file-viewer-web

纯 Web 文件预览组件。这个包是 @file-viewer/web 的历史包名同步版本,提供同样的 <flyfish-file-viewer> 原生 Web Component、mountViewer 命令式 controller、IIFE 全局脚本和资源复制 CLI。

npm install @flyfish-group/file-viewer-web
<flyfish-file-viewer
  id="viewer"
  src="https://example.com/demo.pdf"
  theme="light"
  toolbar-position="bottom-right"
  style="display:block;height:720px"
></flyfish-file-viewer>
import { defineFileViewerElement } from '@flyfish-group/file-viewer-web'

defineFileViewerElement()

const viewer = document.getElementById('viewer')
viewer.addEventListener('viewer-event', event => {
  console.log(event.detail.type, event.detail.payload)
})
viewer.reload()

需要完全命令式控制时,仍可使用 mountViewer(container, options) 返回完整 controller。

鉴权文件可以由宿主系统先下载成 Blob,再通过 filename 交给预览器:

const blob = await fetch('/api/files/contract', { credentials: 'include' }).then(res => res.blob())

const viewer = document.querySelector('flyfish-file-viewer')
viewer.file = blob
viewer.name = 'contract.pdf'

Script 标签接入

无构建工具项目可以自托管 IIFE 包,它会暴露 window.FlyfishFileViewerWeb:

<script src="/vendor/file-viewer-web/flyfish-file-viewer-web.iife.js"></script>
<flyfish-file-viewer
  src="/files/demo.docx"
  theme="light"
  style="display:block;height:720px"
></flyfish-file-viewer>

浏览器不能直接解析 @flyfish-group/file-viewer-web 这种裸包名;没有构建工具时请使用静态 URL、IIFE 全局包,或配置 import map。Worker、WASM 和示例资源可以通过复制命令自托管:

npx --yes file-viewer-copy-assets ./public/file-viewer

options 会透传给共享预览底座,可配置主题、下载/打印/导出 HTML 操作栏、文字或图片水印、搜索高亮、AI 友好文本切片、统一缩放,以及压缩包预览的 Worker、IndexedDB 缓存和体积上限。生命周期、操作能力变化、搜索状态和当前位置会通过 onEvent 回传给宿主,适合记录加载耗时、审计下载/打印尝试、搜索命中、页码/行号、AI 切片和溯源状态。

新项目建议优先使用标准包名 @file-viewer/web。官方文档: https://doc.file-viewer.app/