UNPKG

beth-parser

Version:

Parser library for Bethesda's Creation Engine data files

32 lines 935 B
"use strict"; exports.__esModule = true; /** * Windowed DataSource wrapper. */ var WindowSource = /** @class */ (function () { function WindowSource(source, size) { this.source = source; this.size = size; } WindowSource.prototype.read = function (length) { this.size -= length; if (this.size < 0) { throw new Error("EOF"); } return this.source.read(length); }; WindowSource.prototype.skip = function (length) { this.size -= length; return this.source.skip(length); }; WindowSource.prototype.close = function () { // nothing to close }; WindowSource.prototype.cursor = function () { // Report position of wrapped data source return this.source.cursor(); }; return WindowSource; }()); exports["default"] = WindowSource; //# sourceMappingURL=WindowSource.js.map