Skip to content
This repository was archived by the owner on Jul 26, 2025. It is now read-only.

Commit 8a3792f

Browse files
committed
chore: formatting fixes
1 parent c623c5f commit 8a3792f

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/save/__tests__/encodeBase64.test.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
21
import { createRgbaImage } from '../../../test/testUtils.js';
32
import { encode } from '../encode.js';
43
import { encodeBase64 } from '../encodeBase64.js';
5-
/**
6-
* @vitest-environment jsdom
7-
*/
4+
85
test('basic image (png)', () => {
96
const image = testUtils.createGreyImage([
107
[0, 0, 0, 0, 0],
@@ -86,6 +83,3 @@ test('legacy image-js test', () => {
8683
expect(typeof url).toBe('string');
8784
expect(base64Data).toBe(url.slice(url.indexOf(',') + 1));
8885
});
89-
90-
91-

src/save/encodeBase64.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ import type { ImageFormat } from './encode.js';
1010
* @returns base64 string.
1111
*/
1212
export function encodeBase64(image: Image, format: ImageFormat) {
13-
const buffer = encode(image, { format });
14-
const binaryString = new TextDecoder('latin1').decode(Uint8Array.from(buffer));
15-
const base64String = btoa(binaryString);
16-
return `data:image/${format};base64,${base64String}`;
17-
}
13+
const buffer = encode(image, { format });
14+
const binaryString = new TextDecoder('latin1').decode(
15+
Uint8Array.from(buffer),
16+
);
1817

18+
const base64String = btoa(binaryString);
19+
return `data:image/${format};base64,${base64String}`;
20+
}

0 commit comments

Comments
 (0)