const
     fs = require('fs')
    ,path = require('path')
    ;

let provider = {
    findDirSync :function (t_path) {
        let result=[];
        return Q((resolve,reject) =>{
            fs.readdir(t_path,function(err,files){
                if(err) reject(err);
                files.forEach((val,index)=>{
                    let tempFile = path.parse(val);
                    result.push(tempFile.name)
                });
                resolve(result);
            })
        })
    }
}

function Q(caller) {
    let promise = new Promise(function (resolve, reject) {
        caller(resolve, reject);
    });
    return promise;
}

module.exports =  provider;