2019-05-22 20:22:59 +05:30
|
|
|
const path = require('path')
|
2019-05-21 19:37:11 +05:30
|
|
|
module.exports.mergedir = (dirname,settings)=>{
|
2019-05-22 20:22:59 +05:30
|
|
|
return path.normalize(path.join(settings.dirname,dirname));
|
2019-05-21 19:37:11 +05:30
|
|
|
}
|
|
|
|
|
2019-05-22 20:22:59 +05:30
|
|
|
//produces the contents array
|
|
|
|
module.exports.dirprocess = (dirstream,location,settings)=>{
|
|
|
|
let contents = []
|
2019-05-21 20:31:41 +05:30
|
|
|
dirstream.forEach(element => {
|
2019-05-23 08:40:01 +05:30
|
|
|
//console.log(element)
|
2019-05-22 20:22:59 +05:30
|
|
|
if(!(element.name.startsWith('.')&&!settings.showHidden) )
|
|
|
|
{
|
|
|
|
contents.push({
|
|
|
|
"name":element.name,
|
|
|
|
"path":path.normalize(path.join(location,element.name)) ,
|
|
|
|
"isDir": element.isDirectory()
|
|
|
|
})
|
|
|
|
}
|
2019-05-21 20:31:41 +05:30
|
|
|
});
|
2019-05-22 20:22:59 +05:30
|
|
|
return contents
|
2019-05-21 10:38:54 +05:30
|
|
|
}
|
|
|
|
|