Оптимизации проверок типа файла

This commit is contained in:
Book Pauk
2020-12-19 03:05:58 +07:00
parent 0b63bce357
commit b174ae452b
3 changed files with 11 additions and 4 deletions

View File

@@ -104,7 +104,7 @@ class ConvertBase {
}
isDataXml(data) {
const str = data.toString().trim();
const str = data.slice(0, 100).toString().trim();
return (str.indexOf('<?xml version="1.0"') == 0 || str.indexOf('<?xml version=\'1.0\'') == 0 );
}