From 641cef41d775b6bf88b0ef2d4dad49f2cebcc00e Mon Sep 17 00:00:00 2001 From: franco sanchez Date: Mon, 30 Oct 2023 11:45:08 -0300 Subject: [PATCH] pako package installed to compress images --- src/components/forms/NewBook.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/components/forms/NewBook.tsx b/src/components/forms/NewBook.tsx index 2ad74d0..440fca9 100644 --- a/src/components/forms/NewBook.tsx +++ b/src/components/forms/NewBook.tsx @@ -176,14 +176,9 @@ export function FormNewBook() { reader.onload = function () { const arrayBuffer = reader.result as ArrayBuffer; const uint8Array = new Uint8Array(arrayBuffer); - const byteArray = [...uint8Array]; - // const compressedArrayBuffer = pako.deflate( - // new Uint8Array(arrayBuffer), - // ); - // const byteArray = [...new Uint8Array(compressedArrayBuffer)]; - // console.log(arrayBuffer); - // console.log(uint8Array); - // console.log(byteArray); + const compressedArrayBuffer = pako.deflate(uint8Array); + const byteArray = [...new Uint8Array(compressedArrayBuffer)]; + setBooks((prevBooks) => ({ ...prevBooks, image: {