+/**
+ * @type {Object.<String, String>}
+ */
+let microMap = {
+ // top-left, top-right, bottom-left, bottom-right
+ 0b0000: " ",
+ //
+ 0b0001: "▗",
+ //
+ 0b0010: "▖",
+ //
+ 0b0011: "▄",
+ //
+ 0b0100: "▝",
+ //
+ 0b0101: "▐",
+ //
+ 0b0110: "▞",
+ //
+ 0b0111: "▟",
+ //
+ 0b1000: "▘",
+ //
+ 0b1001: "▚",
+ //
+ 0b1010: "▌",
+ //
+ 0b1011: "▙",
+ //
+ 0b1100: "▀",
+ //
+ 0b1101: "▜",
+ //
+ 0b1110: "▛",
+ //
+ 0b1111: "█",
+};
+
+/**
+ * @param {String} data
+ * @param {QrOpts} opts
+ */
+Qr.microAscii = function (data, opts) {
+ let qrcode = Qr._create(data, opts);
+ let indent = opts?.indent ?? 4;
+ let modules = qrcode.qrcode.modules;
+
+ let ascii = ``.padStart(indent, " ");
+ let length = modules.length;
+ for (let y = 0; y < length; y += 2) {
+ for (let x = 0; x < length; x += 2) {
+ let count = 0;
+ // qr codes can be odd numbers
+ if (x >= length) {
+ ascii += microMap[count];
+ continue;
+ }
+ if (modules[x][y]) {
+ count += 8;
+ }
+ if (modules[x][y + 1]) {
+ count += 2;
+ }
+
+ if (x + 1 >= length) {
+ ascii += microMap[count];
+ continue;
+ }
+ if (modules[x + 1][y]) {
+ count += 4;
+ }
+ if (modules[x + 1][y + 1]) {
+ count += 1;
+ }
+ ascii += microMap[count];
+ }
+ ascii += `\n`.padEnd(indent, " ");
+ }
+ return " ".padEnd(indent - 1, " ") + ascii.trim();
+};
+
+/**
+ * @param {String} data
+ * @param {QrOpts} opts
+ */