修复katex角标漂移等问题

This commit is contained in:
undefined committed 2020-06-24 11:47:43 +08:00
1 parent 1f1efe900c
commit a248425db6
17 files changed
+491 -235

No files matched your search

+32
View File
@@ -1,3 +1,5 @@
const fs = require('fs');
const path = require('path');
const superagent = require('superagent');
const proxy = require('superagent-proxy');
@@ -72,3 +74,33 @@ Set.intersection = function Intersection(setA, setB) {
}
return intersection;
};
/**
* calculate size of a file or directory synchronously
* @param {String} folderPath path of the file or folder
* @param {fsizeOptions} opts additional options
* @returns {Number}
*/
function folderSize(folderPath) {
let size = 0;
const _next = function a(p) {
if (p) {
const stats = fs.statSync(p);
if (!stats.isDirectory() || stats.isSymbolicLink()) {
if (!stats.isSymbolicLink()) size += stats.size;
} else {
size += stats.size;
const files = fs.readdirSync(p);
if (Array.isArray(files)) {
files.forEach((file) => {
_next(path.join(p, file));
});
}
}
}
};
_next(folderPath);
return size;
}
exports.folderSize = folderSize;