UNPKG

@enonic/mock-xp

Version:

Mock Enonic XP API JavaScript Library

28 lines (27 loc) 894 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Resource = void 0; var Resource = (function () { function Resource(_a) { var app = _a.app, path = _a.path; this.app = app; this.path = path.startsWith('/') ? path : "/".concat(path); } Resource.prototype.exists = function () { return this.app.vol.existsSync(this.path); }; Resource.prototype.getSize = function () { return this.app.vol.statSync(this.path).size; }; Resource.prototype.getStream = function () { return this.app.vol.readFileSync(this.path); }; Resource.prototype.getTimestamp = function () { return this.app.vol.statSync(this.path).mtimeMs; }; Resource.prototype.readText = function () { return this.getStream().toString(); }; return Resource; }()); exports.Resource = Resource;