mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-21 05:20:24 +08:00
16 lines
392 B
TypeScript
16 lines
392 B
TypeScript
import jpeg = require("jpeg-js");
|
|
import fs = require("fs");
|
|
|
|
const x = fs.readFileSync("hello.jpg");
|
|
const decoded = jpeg.decode(x, true);
|
|
|
|
const { width, height } = decoded;
|
|
|
|
width; // $ExpectType number
|
|
height; // $ExpectType number
|
|
decoded.data; // $ExpectType Uint8Array
|
|
|
|
fs.writeFileSync("re-encoded.jpg", jpeg.encode({
|
|
width, height, data: decoded.data
|
|
}, 50));
|