stryker-api
Version:
The api for the extendable JavaScript mutation testing framework Stryker
48 lines • 1.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Represents a file within Stryker. Could be a strictly in-memory file.
*/
var File = /** @class */ (function () {
/**
* Creates a new File to be used within Stryker.
* @param name The full name of the file (inc path)
* @param content The buffered or string content of the file
*/
function File(name, content) {
this.name = name;
if (typeof content === 'string') {
this._content = Buffer.from(content);
this._textContent = content;
}
else {
this._content = content;
}
}
Object.defineProperty(File.prototype, "content", {
/**
* Gets the underlying content as buffer.
*/
get: function () {
return this._content;
},
enumerable: true,
configurable: true
});
Object.defineProperty(File.prototype, "textContent", {
/**
* Gets the underlying content as string using utf8 encoding.
*/
get: function () {
if (!this._textContent) {
this._textContent = this.content.toString();
}
return this._textContent;
},
enumerable: true,
configurable: true
});
return File;
}());
exports.default = File;
//# sourceMappingURL=File.js.map