include-me
Version:
[](https://travis-ci.com/Emre-Kul/include-me) 
29 lines • 818 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
class FileManager {
constructor(path) {
this.file = {
content: '',
extension: this.getExtensionFromPath(path),
name: this.getNameFromPath(path),
path,
};
}
loadContent() {
this.file.content = fs.readFileSync(this.file.path, 'utf8');
}
getFile() {
return this.file;
}
getNameFromPath(path) {
const splited = path.split('/');
return splited[splited.length - 1].split('.')[0];
}
getExtensionFromPath(path) {
const splited = path.split('/');
return splited[splited.length - 1].split('.')[1];
}
}
exports.default = FileManager;
//# sourceMappingURL=file-manager.js.map