From c5f4a6056f94feb003934b94eaf5c8fb5e964474 Mon Sep 17 00:00:00 2001 From: Vitaly Domnikov Date: Thu, 29 Sep 2022 14:01:14 -0700 Subject: [PATCH] download feature --- index.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/index.html b/index.html index 01c5927..1cbb4ba 100644 --- a/index.html +++ b/index.html @@ -440,6 +440,7 @@
+
@@ -1227,6 +1228,28 @@ navigator.clipboard.writeText(__output); } + function downloadFile() { + raw = []; + images.each((image) => { + data = imageToString(image) + .split(',') + .map(s => s.trim()) + .filter(Boolean) + .map((byte) => parseInt(byte, 16)); + raw = raw.concat(data); + }); + data = new Uint8Array(raw); + a = document.createElement("a"); + a.style = "display: none"; + document.body.appendChild(a); + blob = new Blob([data], {type: "octet/stream"}); + url = window.URL.createObjectURL(blob); + a.href = url; + a.download = getIdentifier() + ".bin"; + a.click(); + window.URL.revokeObjectURL(url); + } + // Use the horizontally oriented list to draw the image function listToImageHorizontal(list, canvas){