mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-11-17 01:16:27 +01:00
13 lines
261 B
TypeScript
13 lines
261 B
TypeScript
|
import * as fs from 'fs';
|
||
|
import * as 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;
|
||
|
}
|
||
|
}
|