Skip to content

Commit

Permalink
feat: add payload size info
Browse files Browse the repository at this point in the history
  • Loading branch information
Platane committed Jan 11, 2024
1 parent 2a9ea32 commit d2e4324
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ const put = async (key, paths) => {

await s3.put(key, payload);

console.log("uploaded in", Date.now() - a, "ms");
const payloadSize =
(new Uint8Array(payload).length / 1024 / 1024).toFixed(3) + "Mb";
console.log("uploaded in", Date.now() - a, "ms ", payloadSize);
} finally {
fs.rmSync(tmpDir, { recursive: true });
}
Expand All @@ -69,6 +71,12 @@ const get = async (key, paths) => {
Buffer.from(payload)
);

{
const payloadSize =
(new Uint8Array(payload).length / 1024 / 1024).toFixed(3) + "Mb";
console.log(`cache hit ${payloadSize}`);
}

execFileSync("unzip", ["__payload.zip"], { cwd: tmpDir });

for (const filename of paths) {
Expand Down

0 comments on commit d2e4324

Please sign in to comment.