Skip to content

Commit

Permalink
use DataView default offset
Browse files Browse the repository at this point in the history
  • Loading branch information
silverwind committed Feb 15, 2024
1 parent 86de298 commit fcbdbfb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web_src/js/utils/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export async function pngChunks(blob) {
const uint8arr = new Uint8Array(await blob.arrayBuffer());
const chunks = [];
if (uint8arr.length < 8) return chunks;
const view = new DataView(uint8arr.buffer, 0);
const view = new DataView(uint8arr.buffer);
if (view.getBigUint64(0) !== 9894494448401390090n) return chunks;

const decoder = new TextDecoder();
Expand All @@ -26,7 +26,7 @@ export async function pngInfo(blob) {

try {
for (const {name, data} of await pngChunks(blob)) {
const view = new DataView(data.buffer, 0);
const view = new DataView(data.buffer);
if (name === 'IHDR' && data?.length) {
// extract width from mandatory IHDR chunk
width = view.getUint32(0);
Expand Down

0 comments on commit fcbdbfb

Please sign in to comment.