
Security News
Happy Birthday, Shai-Hulud
It has been one year since Shai-Hulud made its first appearance on npm.
@file-viewer/renderer-archive
Advanced tools
Standalone archive renderer plugin for Flyfish File Viewer with libarchive worker, ZIP/TAR fallback, IndexedDB cache, and nested previews.
Flyfish File Viewer 的独立压缩包 renderer 包。它用 libarchive.js Worker + WASM 读取 RAR、7z、ZIP、TAR 等压缩包目录,并在点击内部文件时才按需解压、缓存和调用 File Viewer 的嵌套渲染能力。
import FileViewer from '@file-viewer/vue3'
import { archiveRenderer } from '@file-viewer/renderer-archive'
const options = {
rendererMode: 'replace',
renderers: archiveRenderer,
}
也可以和其他 renderer 一起组合:
import { archiveRenderer } from '@file-viewer/renderer-archive'
import { pdfRenderer } from '@file-viewer/renderer-pdf'
import { cadRenderer } from '@file-viewer/renderer-cad'
const options = {
rendererMode: 'replace',
renderers: [pdfRenderer, cadRenderer, archiveRenderer],
}
libarchive.js 统一解密,默认弹框要求用户输入密码,密码正确后继续读取目录或预览内部文件。libarchive.js Worker + WASM,避免大压缩包阻塞主线程。renderNestedBuffer 或 core dispatcher 复用 PDF、Office、CAD、XMind、图片、代码等现有 renderer。默认会从 viewer assets 下读取:
vendor/libarchive/worker-bundle.jsvendor/libarchive/libarchive.wasm私有化部署时可以通过 options.archive.workerUrl 和 options.archive.wasmUrl 覆盖。
Vue 3 / Vue 2.7 / Vue 2.6 full 包默认把 viewer assets 根设为 /file-viewer/,会自动指向这两个 libarchive 文件;如果部署在其它静态前缀,先调用对应 full 包导出的 setDefaultFullAssetBaseUrl('/your-prefix/') 即可。
const options = {
archive: {
workerUrl: '/file-viewer/vendor/libarchive/worker-bundle.js',
wasmUrl: '/file-viewer/vendor/libarchive/libarchive.wasm',
cache: true,
workerTimeoutMs: 30000,
},
}
压缩包内部文件预览栏的下载按钮默认保持可见。需要隐藏时可以配置全局布尔值:
const options = {
archive: {
entryActions: {
download: false,
},
},
}
也可以按内部路径、扩展名、大小等元数据做判断:
const options = {
archive: {
entryActions: {
download(entry) {
return entry.path.startsWith('public/')
},
},
},
}
这个选项只影响压缩包内部条目的下载按钮,不会关闭顶层 viewer 下载原始压缩包的工具栏动作。
默认情况下,检测到加密内容会显示内置密码弹框。业务也可以预置密码,或接管密码获取流程:
const options = {
archive: {
password: initialPasswordFromYourSystem,
async requestPassword(context) {
// context.filename / context.entryName / context.reason / context.attempt
return await openYourPermissionCheckedPasswordModal(context)
},
},
}
requestPassword 返回字符串时继续解密;返回 null 或 undefined 时取消预览并展示友好提示。错误密码会重新请求密码,不会切换到 JSZip fallback。
@file-viewer/core 已不再内置 archive renderer,也不再为压缩包链路直接安装 libarchive.js。ZIP/TAR/GZIP fallback、jszip、缓存和 Worker 逻辑由本包维护;core 在 OFD 完全拆出前可能仍会因 OFD vendor 临时保留 jszip。需要压缩包预览时,请显式安装本包,或直接使用 @file-viewer/preset-all 聚合能力。
FAQs
Standalone archive renderer plugin for File Viewer with libarchive worker, ZIP/TAR fallback, IndexedDB cache, and nested previews.
The npm package @file-viewer/renderer-archive receives a total of 6,807 weekly downloads. As such, @file-viewer/renderer-archive popularity was classified as popular.
We found that @file-viewer/renderer-archive demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
It has been one year since Shai-Hulud made its first appearance on npm.

Research
/Security News
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.

Security News
GitHub Actions now supports cache-mode, a least-privilege control on the Actions cache aimed at the cache poisoning technique behind recent compromises.