|
|
il y a 1 mois | |
|---|---|---|
| .. | ||
| src | il y a 1 mois | |
| LICENSE | il y a 1 mois | |
| README.en.md | il y a 1 mois | |
| README.md | il y a 1 mois | |
| package.json | il y a 1 mois | |
| tsconfig.json | il y a 1 mois | |
Standalone archive renderer package for Flyfish File Viewer. It reads ZIP, TAR, GZIP, RAR, 7z, and other archive directories with libarchive.js Worker + WASM, then extracts internal files only when the user opens them.
import FileViewer from '@file-viewer/vue3'
import { archiveRenderer } from '@file-viewer/renderer-archive'
const options = {
rendererMode: 'replace',
renderers: archiveRenderer,
}
You can also compose it with other renderer packages:
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 path, the built-in dialog asks for a password, and a correct password unlocks directory reading or nested entry previews.libarchive.js Worker + WASM first to keep large archive parsing off the main thread.renderNestedBuffer or the core dispatcher.Default asset paths are:
vendor/libarchive/worker-bundle.jsvendor/libarchive/libarchive.wasmFor private deployments, override them with options.archive.workerUrl and options.archive.wasmUrl.
const options = {
archive: {
workerUrl: '/file-viewer/vendor/libarchive/worker-bundle.js',
wasmUrl: '/file-viewer/vendor/libarchive/libarchive.wasm',
cache: true,
workerTimeoutMs: 30000,
},
}
By default, encrypted archives open a built-in password dialog. Applications can also provide an initial password or take over password collection:
const options = {
archive: {
password: initialPasswordFromYourSystem,
async requestPassword(context) {
// context.filename / context.entryName / context.reason / context.attempt
return await openYourPermissionCheckedPasswordModal(context)
},
},
}
Return a string from requestPassword to continue. Return null or undefined to cancel and show a friendly notice. Wrong passwords request another password and never switch to the JSZip fallback.
The core package no longer bundles the archive renderer and no longer installs libarchive.js for the archive pipeline. ZIP/TAR/GZIP fallback, jszip, cache, and Worker logic are owned by this package; core may still temporarily retain jszip for the OFD vendor path until OFD is fully extracted. Install this renderer explicitly, or use @file-viewer/preset-all, when archive preview is required.