Przeglądaj źródła

use byteLength to get buffer size

Gildas 7 lat temu
rodzic
commit
573d3c71b9
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      lib/single-file/single-file-browser.js

+ 1 - 1
lib/single-file/single-file-browser.js

@@ -46,7 +46,7 @@ this.SingleFile = (() => {
 				try {
 					const buffer = await resourceContent.arrayBuffer();
 					const dataURI = "data:" + (contentType || "") + ";" + "base64," + base64.fromByteArray(new Uint8Array(buffer));
-					if (options.maxSize && buffer.size > options.maxSize * ONE_MB) {
+					if (options.maxSize && buffer.byteLength > options.maxSize * ONE_MB) {
 						return "data:base64,";
 					} else {
 						return dataURI;