forked from external-repos/squoosh
Compare commits
1 Commits
avif-heade
...
precise-un
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd4e9fd107 |
@@ -19,11 +19,11 @@ function clamp(v, min, max) {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
const suffix = ['B', 'KB', 'MB'];
|
const suffix = ['B', 'KiB', 'MiB'];
|
||||||
function prettyPrintSize(size) {
|
function prettyPrintSize(size) {
|
||||||
const base = Math.floor(Math.log2(size) / 10);
|
const base = Math.floor(Math.log2(size) / 10);
|
||||||
const index = clamp(base, 0, 2);
|
const index = clamp(base, 0, 2);
|
||||||
return (size / 2 ** (10 * index)).toFixed(2) + suffix[index];
|
return (size / 2 ** (10 * index)).toFixed(2) + ' ' + suffix[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
async function decodeFile(file) {
|
async function decodeFile(file) {
|
||||||
|
|||||||
Reference in New Issue
Block a user