alm
Version:
The best IDE for TypeScript
26 lines (25 loc) • 895 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Provides features to navigate the server disk.
* Used to power *open file* and *change working directory*
*/
/** imports */
var types = require("../../../common/types");
var fs = require("fs");
exports.getDirItems = function (dirPath) {
var items = fs.readdirSync(dirPath);
var result = items
.map(function (filePath) { return ({ filePath: filePath, stat: fs.statSync(filePath) }); })
.filter(function (_a) {
var stat = _a.stat;
return stat.isFile() || stat.isDirectory();
})
.map(function (_a) {
var filePath = _a.filePath, stat = _a.stat;
return fs.statSync(filePath).isFile()
? { type: types.FilePathType.File, filePath: filePath }
: { type: types.FilePathType.Dir, filePath: filePath };
});
return [];
};