2016-03-20 16:36:38 +00:00
|
|
|
"use strict";
|
|
|
|
/// <reference path="./typings/main.d.ts" />
|
|
|
|
var plugins = require("./smartfile.plugins");
|
|
|
|
exports.filetype = function (pathArg) {
|
|
|
|
var extName = plugins.path.extname(pathArg);
|
|
|
|
var fileType = extName.replace(/\.([a-z]*)/, "$1"); //remove . form fileType
|
|
|
|
return fileType;
|
|
|
|
};
|
2016-04-14 18:33:58 +00:00
|
|
|
exports.foldersSync = function (pathArg) {
|
|
|
|
return plugins.fs.readdirSync(pathArg).filter(function (file) {
|
|
|
|
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
exports.folders = function (pathArg) {
|
|
|
|
var done = plugins.q.defer();
|
|
|
|
var 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
|
|
|
|
2016-05-01 21:19:54 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5nZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDRDQUE0QztBQUM1QyxJQUFPLE9BQU8sV0FBVyxxQkFBcUIsQ0FBQyxDQUFDO0FBRXJDLGdCQUFRLEdBQUcsVUFBUyxPQUFjO0lBQ3pDLElBQUksT0FBTyxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0lBQzVDLElBQUksUUFBUSxHQUFHLE9BQU8sQ0FBQyxPQUFPLENBQUMsWUFBWSxFQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsd0JBQXdCO0lBQzNFLE1BQU0sQ0FBQyxRQUFRLENBQUM7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