import React, { FC, useEffect, useRef, useState } from 'react'; import FilePicker from './components/file-picker'; import CodeBox from './components/code-box'; const App: FC = () => { const [err, setErr] = useState(null); const [files, setFiles] = useState([]); const cbRef = useRef(null); useEffect(() => { if (files && files.length) { cbRef.current!.scrollIntoView({ behavior: 'smooth' // Hopefully IE just ignores this value }); } }, [files]); return ( <>
fflate
a fast compression library by 101arrowz
You've found fflate, the fastest pure JavaScript compression library in existence.

You can both pack and expand Zlib, GZIP, DEFLATE, or ZIP files very quickly with just a few lines of code.

Weighing in at a measly 8kB for basic compression and decompression, you don't need to worry about your bundle size ballooning.

Despite utilizing multiple cores, supporting data streams, and being very memory efficient, fflate is compatible with both Node.js and browsers as old as IE11.

You can read more about fflate on GitHub. Try the demo below to see its performance for yourself. The code boxes are editable; try changing parameters or using a different compression format.

Disclaimer: I added a lot of sugar (around 4 hundred lines) to the UZIP and Pako APIs to make the demo clean and asynchronous, but the fflate API is unmodified.

{}}> {err &&
Error: {err}
}
{files ? ((files.length || 'No') + ' file' + (files.length == 1 ? '' : 's') + ' selected') : 'Loading...'}

{((!files || files.length) && ) || null}
); } export default App;