Skip to content

Commit 0b77f28

Browse files
committed
fix porting errors
1 parent c2c22e3 commit 0b77f28

3 files changed

Lines changed: 7 additions & 9 deletions

File tree

‎ImageScript.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,12 +1522,10 @@ class ImageType {
15221522
* @param {boolean} [onlyExtractFirstFrame] Whether to end GIF decoding after the first frame
15231523
* @returns {Promise<GIF|Image>} The decoded image
15241524
*/
1525-
function decode(data, onlyExtractFirstFrame) {
1525+
export function decode(data, onlyExtractFirstFrame) {
15261526
const type = ImageType.getType(data);
15271527

15281528
if (type === 'gif')
15291529
return GIF.decode(data, onlyExtractFirstFrame);
15301530
return Image.decode(data);
15311531
}
1532-
1533-
module.exports = {Image, GIF, Frame, TextLayout, ImageType, decode};

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ It can achieve much more performant results by utilizing lower-level memory acce
3232

3333
---
3434

35-
If you have any additional questions, feel free to join the [discord support server](https://discord.gg/8hPrwAH).
35+
If you have any additional questions, feel free to join the [discord support server](https://discord.gg/8hPrwAH).

‎tests/fisheye.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
const fs = require('fs').promises;
2-
const {Image} = require('../ImageScript');
1+
import {Image} from '../ImageScript.js';
2+
import {equals} from 'https://deno.land/std@0.80.0/bytes/mod.ts';
33

44
(async () => {
5-
const input = await fs.readFile('./tests/targets/external.png');
5+
const input = await Deno.readFile('./tests/targets/external.png');
66

77
const image = await Image.decode(input);
88
image.fisheye();
99

1010
const output = await image.encode();
11-
const target = await fs.readFile('./tests/targets/fisheye.png');
11+
const target = await Deno.readFile('./tests/targets/fisheye.png');
1212

13-
if (!Buffer.from(target).equals(Buffer.from(output)))
13+
if (!equals(output, target))
1414
process.exit(1);
1515
})();

0 commit comments

Comments
 (0)