@clxrity/zip
Version:
A React zip utility library
54 lines (41 loc) • 964 B
Markdown
A React library for zipping and unzipping files in the browser.
```zsh
npm install @clxrity/zip
```
```zsh
yarn add @clxrity/zip
```
```zsh
pnpm add @clxrity/zip
```
---
```tsx
'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>
)
}
```
