mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-31 07:11:33 +00:00
fix: use fs-jetpack in scripts/thumbs.js
This commit is contained in:
parent
ebd53996d7
commit
516457709f
@ -1,3 +1,4 @@
|
|||||||
|
const jetpack = require('fs-jetpack')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const paths = require('./../controllers/pathsController')
|
const paths = require('./../controllers/pathsController')
|
||||||
const utils = require('./../controllers/utilsController')
|
const utils = require('./../controllers/utilsController')
|
||||||
@ -9,12 +10,14 @@ const self = {
|
|||||||
([2, 3].includes(self.mode) && utils.videoExts.includes(extname))
|
([2, 3].includes(self.mode) && utils.videoExts.includes(extname))
|
||||||
},
|
},
|
||||||
getFiles: async directory => {
|
getFiles: async directory => {
|
||||||
const names = await paths.readdir(directory)
|
const names = await jetpack.listAsync(directory)
|
||||||
const files = []
|
const files = []
|
||||||
for (const name of names) {
|
if (Array.isArray(names) && names.length) {
|
||||||
const lstat = await paths.lstat(path.join(directory, name))
|
for (const name of names) {
|
||||||
if (lstat.isFile() && !name.startsWith('.')) {
|
const exists = await jetpack.existsAsync(path.join(directory, name))
|
||||||
files.push(name)
|
if (exists === 'file' && !name.startsWith('.')) {
|
||||||
|
files.push(name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return files
|
return files
|
||||||
|
Loading…
Reference in New Issue
Block a user