2016-05-19 22:31:53 +00:00
|
|
|
"use strict";
|
2017-04-27 14:48:08 +00:00
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
|
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
});
|
|
|
|
};
|
2017-03-04 20:10:46 +00:00
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2017-04-27 14:48:08 +00:00
|
|
|
/**
|
|
|
|
* class Smartfile
|
|
|
|
* -> is vinyl file compatible
|
|
|
|
*/
|
2016-07-17 15:34:15 +00:00
|
|
|
class Smartfile {
|
2017-04-27 14:48:08 +00:00
|
|
|
/**
|
|
|
|
* the constructor of Smartfile
|
|
|
|
* @param optionsArg
|
|
|
|
*/
|
2017-03-04 20:10:46 +00:00
|
|
|
constructor(optionsArg) {
|
|
|
|
if (optionsArg.contentBuffer) {
|
2017-04-29 15:20:09 +00:00
|
|
|
this.contentBuffer = optionsArg.contentBuffer;
|
2017-03-04 20:10:46 +00:00
|
|
|
this.contents = optionsArg.contentBuffer;
|
|
|
|
}
|
2017-04-29 15:20:09 +00:00
|
|
|
else if (optionsArg.contentString) {
|
|
|
|
this.contents = Buffer.from(optionsArg.contentString);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
console.log('created empty Smartfile?');
|
2017-03-04 20:10:46 +00:00
|
|
|
}
|
|
|
|
this.path = optionsArg.path;
|
|
|
|
}
|
2017-04-27 14:48:08 +00:00
|
|
|
/**
|
|
|
|
* return relative path of file
|
|
|
|
* ->
|
|
|
|
*/
|
|
|
|
get relative() {
|
|
|
|
return '';
|
|
|
|
}
|
2017-03-04 20:10:46 +00:00
|
|
|
/**
|
|
|
|
* set contents from string
|
|
|
|
* @param contentString
|
|
|
|
*/
|
2017-04-27 14:48:08 +00:00
|
|
|
setContentsFromString(contentString) {
|
2017-03-04 20:10:46 +00:00
|
|
|
this.contents = new Buffer(contentString);
|
2016-05-19 22:31:53 +00:00
|
|
|
}
|
2017-04-27 14:48:08 +00:00
|
|
|
/**
|
|
|
|
* write file to disk
|
|
|
|
*/
|
|
|
|
write() {
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* read file from disk
|
|
|
|
*/
|
|
|
|
read() {
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
});
|
|
|
|
}
|
2016-07-17 15:34:15 +00:00
|
|
|
}
|
2016-05-19 22:31:53 +00:00
|
|
|
exports.Smartfile = Smartfile;
|
2017-04-29 15:20:09 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRmaWxlLmNsYXNzZXMuc21hcnRmaWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRmaWxlLmNsYXNzZXMuc21hcnRmaWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFRQTs7O0dBR0c7QUFDSDtJQTBCRTs7O09BR0c7SUFDSCxZQUFhLFVBQXdDO1FBQ25ELEVBQUUsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxhQUFhLENBQUMsQ0FBQyxDQUFDO1lBQzdCLElBQUksQ0FBQyxhQUFhLEdBQUcsVUFBVSxDQUFDLGFBQWEsQ0FBQTtZQUM3QyxJQUFJLENBQUMsUUFBUSxHQUFHLFVBQVUsQ0FBQyxhQUFhLENBQUE7UUFDMUMsQ0FBQztRQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQyxVQUFVLENBQUMsYUF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