App.tsx 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import React, { FC, useState } from 'react';
  2. import FilePicker from './components/file-picker';
  3. import CodeBox from './components/code-box';
  4. const App: FC = () => {
  5. const [files, setFiles] = useState<File[]>([])
  6. return (
  7. <>
  8. <div style={{
  9. display: 'flex',
  10. fontSize: '70px',
  11. justifyContent: 'space-between',
  12. flexDirection: 'row',
  13. overflow: 'hidden',
  14. width: '100%',
  15. fontWeight: 'bold'
  16. }}>
  17. <div style={{ paddingLeft: '0.25em' }}>
  18. fflate
  19. <div style={{
  20. color: 'gray',
  21. fontSize: '0.25em',
  22. fontWeight: 'lighter'
  23. }}>a fast compression library by <a href="//github.com/101arrowz" style={{ color: 'gray' }}>101arrowz</a></div>
  24. </div>
  25. <a href="//github.com/101arrowz/fflate">
  26. <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 250 250" fill="white">
  27. <path d="M0 0l115 115h15l12 27 108 108V0z" fill="black"/>
  28. <path d="M128 109c-15-9-9-19-9-19 3-7 2-11 2-11-1-7 3-2 3-2 4 5 2 11 2 11-3 10 5 15 9 16" style={{ transformOrigin: '130px 106px' }} />
  29. <path d="M115 115s4 2 5 0l14-14c3-2 6-3 8-3-8-11-15-24 2-41 5-5 10-7 16-7 1-2 3-7 12-11 0 0 5 3 7 16 4 2 8 5 12 9s7 8 9 12c14 3 17 7 17 7-4 8-9 11-11 11 0 6-2 11-7 16-16 16-30 10-41 2 0 3-1 7-5 11l-12 11c-1 1 1 5 1 5z"/>
  30. </svg>
  31. </a>
  32. </div>
  33. <div style={{
  34. display: 'flex',
  35. justifyContent: 'center',
  36. alignItems: 'center',
  37. flexDirection: 'column',
  38. textAlign: 'center',
  39. width: '100%',
  40. flex: 1
  41. }}>
  42. <div style={{ maxWidth: '80%', fontSize: 'calc(18px + 0.6vw)', paddingTop: '4vh', paddingBottom: '2vh' }}>
  43. You've found <a href="//npmjs.com/package/fflate">fflate</a>, the fastest pure JavaScript compression library in existence.
  44. <br /><br />
  45. You can both pack and expand Zlib, GZIP, DEFLATE, or ZIP files very quickly with just a few lines of code.
  46. <br /><br />
  47. Weighing in at a measly 8kB for basic (de)compression, you don't need to worry about your bundle size ballooning.
  48. <br /><br />
  49. 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.
  50. <br /><br />
  51. You can read more about fflate on <a href="//github.com/package/fflate">GitHub</a>. Try the demo below to see its performance for yourself.
  52. <br />
  53. <span style={{ fontSize: '0.5em' }}>I added a <i>lot</i> 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.</span>
  54. </div>
  55. <div>
  56. <FilePicker allowDirs onFiles={setFiles} onError={console.log} onDrag={() => {}} />
  57. <CodeBox files={files} />
  58. </div>
  59. </div>
  60. </>
  61. );
  62. }
  63. export default App;