Fix regression in gathering folder size
This commit is contained in:
parent
b322095c95
commit
54203cbc41
3 changed files with 21 additions and 13 deletions
16
dist/post/index.js
vendored
16
dist/post/index.js
vendored
|
|
@ -84199,13 +84199,9 @@ async function getFolderSize (rootItemPath, options = {}) {
|
||||||
async function processItem (itemPath) {
|
async function processItem (itemPath) {
|
||||||
if (options.ignore?.test(itemPath)) return
|
if (options.ignore?.test(itemPath)) return
|
||||||
|
|
||||||
try {
|
const stats = lstatSync(itemPath, { bigint: true })
|
||||||
const stats = fs.lstatSync(itemPath, { bigint: true })
|
|
||||||
} catch (error) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof stats !== 'object') return
|
if (typeof stats !== 'object') return
|
||||||
|
|
||||||
fileSizes.set(stats.ino, stats.size)
|
fileSizes.set(stats.ino, stats.size)
|
||||||
|
|
||||||
if (stats.isDirectory()) {
|
if (stats.isDirectory()) {
|
||||||
|
|
@ -84231,6 +84227,14 @@ async function getFolderSize (rootItemPath, options = {}) {
|
||||||
return folderSize
|
return folderSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function lstatSync(path, opts) {
|
||||||
|
try {
|
||||||
|
return fs.lstatSync(path, opts)
|
||||||
|
} catch (error) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = { getFolderSize }
|
module.exports = { getFolderSize }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
2
dist/post/index.js.map
vendored
2
dist/post/index.js.map
vendored
File diff suppressed because one or more lines are too long
16
util.js
16
util.js
|
|
@ -12,13 +12,9 @@ async function getFolderSize (rootItemPath, options = {}) {
|
||||||
async function processItem (itemPath) {
|
async function processItem (itemPath) {
|
||||||
if (options.ignore?.test(itemPath)) return
|
if (options.ignore?.test(itemPath)) return
|
||||||
|
|
||||||
try {
|
const stats = lstatSync(itemPath, { bigint: true })
|
||||||
const stats = fs.lstatSync(itemPath, { bigint: true })
|
|
||||||
} catch (error) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof stats !== 'object') return
|
if (typeof stats !== 'object') return
|
||||||
|
|
||||||
fileSizes.set(stats.ino, stats.size)
|
fileSizes.set(stats.ino, stats.size)
|
||||||
|
|
||||||
if (stats.isDirectory()) {
|
if (stats.isDirectory()) {
|
||||||
|
|
@ -44,4 +40,12 @@ async function getFolderSize (rootItemPath, options = {}) {
|
||||||
return folderSize
|
return folderSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function lstatSync(path, opts) {
|
||||||
|
try {
|
||||||
|
return fs.lstatSync(path, opts)
|
||||||
|
} catch (error) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = { getFolderSize }
|
module.exports = { getFolderSize }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue