1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-21 01:59:07 +09:00
misskey/src/misc/check-svg.ts
2019-03-13 09:19:48 +09:00

13 lines
256 B
TypeScript

import * as fs from 'fs';
import isSvg from 'is-svg';
export default function(path: string) {
try {
const size = fs.statSync(path).size;
if (size > 1 * 1024 * 1024) return false;
return isSvg(fs.readFileSync(path));
} catch {
return false;
}
}