mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-24 05:43:09 +02:00
12 lines
256 B
TypeScript
12 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;
|
|
}
|
|
}
|