Skip to content

Commit

Permalink
remove total var.
Browse files Browse the repository at this point in the history
  • Loading branch information
dojyorin authored Nov 29, 2022
1 parent 7fda735 commit 13cbcce
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/minipack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;

Expand Down

0 comments on commit 13cbcce

Please sign in to comment.