2016-05-23 06:15:47 +00:00
|
|
|
import "typings-global";
|
2016-03-20 16:36:38 +00:00
|
|
|
import plugins = require("./smartfile.plugins");
|
|
|
|
|
|
|
|
export let filetype = function(pathArg:string):string {
|
|
|
|
let extName = plugins.path.extname(pathArg);
|
|
|
|
let fileType = extName.replace(/\.([a-z]*)/,"$1"); //remove . form fileType
|
|
|
|
return fileType;
|
2016-04-14 18:33:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export let foldersSync = function(pathArg){
|
|
|
|
return plugins.fs.readdirSync(pathArg).filter(function(file) {
|
|
|
|
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
export let folders = function(pathArg:string){
|
|
|
|
let done = plugins.q.defer();
|
|
|
|
let folderArray = plugins.fs.readdirSync(pathArg).filter(function(file) {
|
|
|
|
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
|
|
|
});
|
|
|
|
done.resolve(folderArray);
|
|
|
|
return done.promise;
|
2016-03-20 16:36:38 +00:00
|
|
|
};
|