Fix regression in gathering folder size

This commit is contained in:
Alex Rodionov 2023-11-26 17:11:31 -08:00
parent b322095c95
commit 54203cbc41
3 changed files with 21 additions and 13 deletions

16
dist/post/index.js vendored
View file

@ -84199,13 +84199,9 @@ async function getFolderSize (rootItemPath, options = {}) {
async function processItem (itemPath) {
if (options.ignore?.test(itemPath)) return
try {
const stats = fs.lstatSync(itemPath, { bigint: true })
} catch (error) {
return
}
const stats = lstatSync(itemPath, { bigint: true })
if (typeof stats !== 'object') return
fileSizes.set(stats.ino, stats.size)
if (stats.isDirectory()) {
@ -84231,6 +84227,14 @@ async function getFolderSize (rootItemPath, options = {}) {
return folderSize
}
function lstatSync(path, opts) {
try {
return fs.lstatSync(path, opts)
} catch (error) {
return
}
}
module.exports = { getFolderSize }

File diff suppressed because one or more lines are too long

16
util.js
View file

@ -12,13 +12,9 @@ async function getFolderSize (rootItemPath, options = {}) {
async function processItem (itemPath) {
if (options.ignore?.test(itemPath)) return
try {
const stats = fs.lstatSync(itemPath, { bigint: true })
} catch (error) {
return
}
const stats = lstatSync(itemPath, { bigint: true })
if (typeof stats !== 'object') return
fileSizes.set(stats.ino, stats.size)
if (stats.isDirectory()) {
@ -44,4 +40,12 @@ async function getFolderSize (rootItemPath, options = {}) {
return folderSize
}
function lstatSync(path, opts) {
try {
return fs.lstatSync(path, opts)
} catch (error) {
return
}
}
module.exports = { getFolderSize }