From 13cbcce45758eded10968ad93a8136b0b2ec367e Mon Sep 17 00:00:00 2001 From: Kazuki Ota Date: Tue, 29 Nov 2022 20:42:02 +0900 Subject: [PATCH] remove total var. --- src/minipack.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/minipack.ts b/src/minipack.ts index 811f18f..af3e25e 100644 --- a/src/minipack.ts +++ b/src/minipack.ts @@ -5,7 +5,6 @@ import {ucEncode, ucDecode, hexEncode} from "./text.ts"; const sizeHash = 32; const sizeName = 1; const sizeBody = 4; -const sizeTotal = sizeHash + sizeName + sizeBody; /** * Encode data into a byte array in "minipack" format. @@ -14,7 +13,7 @@ const sizeTotal = sizeHash + sizeName + sizeBody; * @see https://deno.land/x/simple_utility */ export async function minipackEncode(files:FileInit[]){ - const archive = new Uint8Array(files.reduce((a, [k, v]) => a + sizeTotal + ucEncode(k).byteLength + v.byteLength, 0)); + const archive = new Uint8Array(files.reduce((a, [k, v]) => a + sizeHash + sizeName + sizeBody + ucEncode(k).byteLength + v.byteLength, 0)); let offset = 0;