flyfish-dev/file-viewer
flyfish-dev/file-viewer has 2,882 GitHub stars and 295 forks. GitHot measured +18 stars in 24 hours, +153 in 7 days, and +247 in 15 days. Last checked 2026-11-11 01:23 UTC. Last push 2026-11-01.
Comment ces chiffres sont mesurés
Prévisualisez plus de 275 formats de fichiers dans le navigateur, notamment Office, PDF, OFD, CAD, les fichiers 3D et les archives. Fonctionne entièrement côté client, sans conversion sur le serveur. Compatible avec Vue, React, Svelte et les Web Components.
Progression mesurée des étoiles
- in 24h
- +18
- in 7 days
- +153
- in 15 days
- +247
- in 1 month
- Mise à jour retardée
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalFile Viewer
File Viewer provides read-only previews for Office, PDF/OFD, CAD, archives, email and more, in the browser.
Built-in renderers need no conversion server; Workers, WASM and fonts can be self-hosted.
English · 简体中文
Live demo · Documentation · Flutter SDK (preview) · Format matrix · Releases
⭐ If File Viewer helps you, please star the repo.
For fixes and package versions, see the changelog.
Why File Viewer
- 275 registered extensions (225 stable, 50 experimental) across 47 preview pipelines: Word, Excel, PowerPoint, PDF, OFD, DWG/DXF, STEP/IFC, archives, email, images, media, code, DICOM and more.
- No conversion server. Files are parsed and rendered in the browser; Workers, WASM and fonts can be self-hosted for offline networks.
- Loads only what a file needs. Heavy engines (PDF, CAD, Office, 3D) are lazy-loaded per format.
- One API, every framework. Web Component, Vue 3, Vue 2.7/2.6, React 16.8–19, Svelte and jQuery share options, events and controller methods.
Quick start
The Web Component works without a framework:
npm install @file-viewer/web-full
import { mountViewer } from '@file-viewer/web-full'
mountViewer(document.querySelector('#viewer'), {
url: '/documents/handbook.pdf',
filename: 'handbook.pdf'
})
Give #viewer a height. The URL must be reachable by the browser; cross-origin files need the appropriate CORS headers. You can also pass a File instead of a URL.
For a new project, npm create file-viewer@latest my-viewer sets up a runnable example. To add File Viewer to an existing project, use npx file-viewer-cli@latest add .. The CLI guide describes the packages and assets each choice installs.
| Application | Light component | Full compatibility package | Guide |
|---|---|---|---|
| Vanilla JS / Web Component | @file-viewer/web |
@file-viewer/web-full |
Web |
| Vue 3 | @file-viewer/vue3 |
@file-viewer/vue3-full |
Vue 3 |
| Vue 2.7 / 2.6 | @file-viewer/vue2.7 / @file-viewer/vue2.6 |
matching -full package |
Vue 2 |
| React 18 / 19 | @file-viewer/react |
@file-viewer/react-full |
React |
| React 16.8 / 17 | @file-viewer/react-legacy |
@file-viewer/react-legacy-full |
React Legacy |
| Svelte | @file-viewer/svelte |
@file-viewer/svelte-full |
Svelte |
| jQuery | @file-viewer/jquery |
@file-viewer/jquery-full |
jQuery |
For formats beyond a light component's built-in baseline, add a preset or individual renderers. For example:
import officePreset from '@file-viewer/preset-office'
import { FileViewer } from '@file-viewer/vue3'
const options = { preset: officePreset }
options.preset also accepts an array. See presets and renderers for the available combinations.
Flutter development preview
The independent File Viewer Flutter SDK is available on pub.dev as development preview 0.1.0-dev.2. It provides bundled offline assets, application-scoped warm-up and reusable viewer sessions. Start with the Flutter quick start, or read the complete integration guides.
Android, iOS, Web, Windows, macOS and Linux are the delivery targets. Follow the platform guide for measured support and remaining qualification. Sessions stay within the application process; operating systems can suspend or terminate it. The Flutter repository contains the SDK source and runnable example.
Formats and limits
The format matrix lists extensions, renderer packages, support levels and evidence. It covers common documents and media as well as specialist formats such as engineering drawings, 3D models and design files. An extension in the matrix does not mean every file of that type has identical fidelity.
The eight *-full packages preserve the published v2.4 preset-all compatibility baseline: 221 extensions across 32 preview pipelines. New specialist renderers, including Adobe design files, DICOM and binary inspection, are installed explicitly; they are not silently added to existing Full packages. For a smaller installation, choose a light component with @file-viewer/preset-lite, @file-viewer/preset-office, @file-viewer/preset-engineering or individual renderers.
File Viewer is a viewer, not an editor. Fonts, vendor-specific features, encrypted files and very large inputs can affect fidelity or memory use. Check the format matrix before relying on a specialist format in production, and test with representative files from your own workflow.
Opt-in BPMN diagrams (@file-viewer/renderer-drawing/bpmn) and XML validation/transformation profiles (@file-viewer/renderer-text/xml-profiles) ship on npm since 3.1.2; they are not added to Full packages.
Runtime assets
Full packages include version-matched Workers, WASM, fonts and vendor assets, but those files must be served alongside your application. The default asset path is <deployment-base>/file-viewer/.
| Build or delivery | Asset step |
|---|---|
| Vite | Install @file-viewer/vite-plugin and configure fileViewerRenderers({ copyAssets: true }). |
| Webpack, Rspack, Rollup, Vue CLI or Umi | Run npx --no-install file-viewer-copy-assets ./public/file-viewer with the matching Full package installed. |
| Web Full IIFE / CDN | Serve the complete package dist/ directory, not only the entry JavaScript file. |
For nonstandard paths and offline deployments, see the asset and distribution guide. A missing Worker or WASM file can leave a format unavailable even when its JavaScript package is installed.
Work from source
This repository contains the public source for the core, renderers, presets, components, CLI, demo and documentation. Released archives and npm tarballs are available from GitHub Releases, rather than tracked in Git.
pnpm install --frozen-lockfile
pnpm type-check
pnpm test
pnpm build
pnpm docs:build
pnpm verify:browser-smoke
Contributing and support
If a documented format fails, please include a sanitized sample or a public reproduction link, the browser version and the expected result. A screenshot alone rarely identifies a parser or rendering bug. Read CONTRIBUTING.md before opening a pull request; report security issues through SECURITY.md.
New contributors: local development, international collaboration, and translations. English and Chinese are welcome; other languages can include a short English summary.
Maintenance is supported through GitHub Sponsors. For private deployment or work requiring a response commitment, see enterprise support.
Thanks to Our Sponsors
Star History
License
File Viewer's own source is Apache-2.0. The DWG/DWF/DWFX runtime (@flyfish-dev/cad-viewer and dwf-viewer) is AGPL-3.0-only; using or distributing CAD support requires complying with that license. See LICENSE and the runtime package notices.
PDF URL loading
Standard component PDF URLs stream on the same origin by default. Use pdf.streaming: true plus an explicit filename/type for CORS-enabled signed URLs, or false to buffer once. For demanded Range reads set both pdf.disableStream and pdf.disableAutoFetch to true; server Range/CORS support is required. Explicit bytes and caller-owned fetch hooks retain precedence.
Explorer des projets similaires
freeCodeCamp/freeCodeCamp
La base de code open source et le cursus de freeCodeCamp.org. Apprenez gratuitement les mathématiques, la programmation et l'informatique.
459,004 étoilesdonnemartin/system-design-primer
Apprenez à concevoir des systèmes à grande échelle et préparez-vous à l’entretien de conception de systèmes. Comprend des cartes mémoire Anki.
377,619 étoilesreact/react
La bibliothèque pour les interfaces utilisateur web et natives.
252,527 étoilesvuejs/vue
Voici le dépôt de Vue 2. Pour Vue 3, rendez-vous sur https://github.com/vuejs/core
212,532 étoiles
