2019-03-03 00:48:02 +01:00
|
|
|
import * as fs from 'fs';
|
2019-03-13 01:19:48 +01:00
|
|
|
import isSvg from 'is-svg';
|
2019-03-03 00:48:02 +01:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|