Skip to content

Commit 8a7ac66

Browse files
committed
fix: file.bytes() unsupported in chrome #2
1 parent 3efc822 commit 8a7ac66

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

presets/Basic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export async function renderSVG(qr, params) {
152152
svg += `</g>`;
153153

154154
if (file != null) {
155-
const bytes = await file.bytes();
155+
const bytes = new Uint8Array(await file.arrayBuffer());
156156
const b64 = btoa(
157157
Array.from(bytes, (byte) => String.fromCodePoint(byte)).join("")
158158
);

presets/Circle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export async function renderSVG(qr, params) {
206206
svg += `"/>`;
207207

208208
if (file != null) {
209-
const bytes = await file.bytes();
209+
const bytes = new Uint8Array(await file.arrayBuffer());
210210
const b64 = btoa(
211211
Array.from(bytes, (byte) => String.fromCodePoint(byte)).join("")
212212
);

presets/Halftone.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Module } from "https://qrframe.kylezhe.ng/utils.js";
1+
import { Module } from "REPLACE_URL/utils.js";
22

33
export const paramsSchema = {
44
Image: {

src/lib/presets/Basic.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export async function renderSVG(qr, params) {
152152
svg += \`</g>\`;
153153
154154
if (file != null) {
155-
const bytes = await file.bytes();
155+
const bytes = new Uint8Array(await file.arrayBuffer());
156156
const b64 = btoa(
157157
Array.from(bytes, (byte) => String.fromCodePoint(byte)).join("")
158158
);

src/lib/presets/Circle.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export async function renderSVG(qr, params) {
206206
svg += \`"/>\`;
207207
208208
if (file != null) {
209-
const bytes = await file.bytes();
209+
const bytes = new Uint8Array(await file.arrayBuffer());
210210
const b64 = btoa(
211211
Array.from(bytes, (byte) => String.fromCodePoint(byte)).join("")
212212
);

0 commit comments

Comments
 (0)