mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-18 17:21: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 paths = require('./../controllers/pathsController')
|
||||
const utils = require('./../controllers/utilsController')
|
||||
@ -9,12 +10,14 @@ const self = {
|
||||
([2, 3].includes(self.mode) && utils.videoExts.includes(extname))
|
||||
},
|
||||
getFiles: async directory => {
|
||||
const names = await paths.readdir(directory)
|
||||
const names = await jetpack.listAsync(directory)
|
||||
const files = []
|
||||
for (const name of names) {
|
||||
const lstat = await paths.lstat(path.join(directory, name))
|
||||
if (lstat.isFile() && !name.startsWith('.')) {
|
||||
files.push(name)
|
||||
if (Array.isArray(names) && names.length) {
|
||||
for (const name of names) {
|
||||
const exists = await jetpack.existsAsync(path.join(directory, name))
|
||||
if (exists === 'file' && !name.startsWith('.')) {
|
||||
files.push(name)
|
||||
}
|
||||
}
|
||||
}
|
||||
return files
|
||||
|
Loading…
Reference in New Issue
Block a user