|
|
@ -15,17 +15,17 @@ module.exports = (check=false) => { |
|
|
|
|
|
|
|
|
|
|
|
for (const file of ldir) { |
|
|
|
for (const file of ldir) { |
|
|
|
let ofile = {}; |
|
|
|
let ofile = {}; |
|
|
|
ofile.icon = fileIcon(`${dir}\\${file}`, file); |
|
|
|
ofile.icon = fileIcon(`${dir}/${file}`, file); |
|
|
|
ofile.name = trimext.includes(path.extname(file)) ? file.slice(0, file.length - path.extname(file).length) : file; |
|
|
|
ofile.name = trimext.includes(path.extname(file)) ? file.slice(0, file.length - path.extname(file).length) : file; |
|
|
|
try {ofile.type = fs.lstatSync(`${dir}\\${file}`).isDirectory() ? "File Folder" : (extensions[path.extname(file).slice(1)] || "File");} |
|
|
|
try {ofile.type = fs.lstatSync(`${dir}/${file}`).isDirectory() ? "File Folder" : (extensions[path.extname(file).slice(1)] || "File");} |
|
|
|
catch {ofile.type = `${path.extname(file)} File`.trim();} |
|
|
|
catch {ofile.type = `${path.extname(file)} File`.trim();} |
|
|
|
try {ofile.lastModified = new Date(fs.lstatSync(`${dir}\\${file}`).mtimeMs);} |
|
|
|
try {ofile.lastModified = new Date(fs.lstatSync(`${dir}/${file}`).mtimeMs);} |
|
|
|
catch {ofile.lastModified = 0;} |
|
|
|
catch {ofile.lastModified = 0;} |
|
|
|
try {ofile.lastModifiedString = ofile.lastModified === 0 ? '' : moment(ofile.lastModified).format('M/D/YYYY, h:mm:ssa');} |
|
|
|
try {ofile.lastModifiedString = ofile.lastModified === 0 ? '' : moment(ofile.lastModified).format('M/D/YYYY, h:mm:ssa');} |
|
|
|
catch {ofile.lastModifiedString = '';} |
|
|
|
catch {ofile.lastModifiedString = '';} |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (fs.lstatSync(`${dir}\\${file}`).isFile()) { |
|
|
|
if (fs.lstatSync(`${dir}/${file}`).isFile()) { |
|
|
|
ofile.size = fs.lstatSync(`${dir}\\${file}`).size; |
|
|
|
ofile.size = fs.lstatSync(`${dir}/${file}`).size; |
|
|
|
ofile.sizeString = `${getsize(ofile.size)}`; |
|
|
|
ofile.sizeString = `${getsize(ofile.size)}`; |
|
|
|
ofile.dir = false; |
|
|
|
ofile.dir = false; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|