0.1.2 • Published 7 months ago
@clxrity/zip v0.1.2
Zip
@clxrity/zip
A React library for zipping and unzipping files in the browser.
Installation
npm install @clxrity/zipyarn add @clxrity/zippnpm add @clxrity/zipComponent usage (client-side)
Zipping files
With Next.js
'use client';
import { FileUpload } from '@clxrity/zip/client';
export default function Page() {
return (
<div>
<h1>Upload a file</h1>
<FileUpload
mode="zip" // 'zip' or 'unzip' (default is 'zip')
onBeforeZip={(files) => {
// Handle files before zipping
console.log('Files to zip:', files);
return files; // Return the files to be zipped
}}
onAfterZip={(blob) => {
// Handle the zipped file
console.log('Zipped file:', blob);
})
/>
</div>
)
}