mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
10 lines
292 B
TypeScript
10 lines
292 B
TypeScript
import isSvg from 'is-svg';
|
|
|
|
// this has a overhead of converting to string for testing if it is svg.
|
|
// is there a more performant way?
|
|
export function isSvgBuffer(buffer: Uint8Array) {
|
|
const decoder = new TextDecoder('utf-8');
|
|
const str = decoder.decode(buffer);
|
|
return isSvg(str);
|
|
}
|