diff --git a/base/ReaderBase.ts b/base/ReaderBase.ts index 0089b36..eb08d1d 100644 --- a/base/ReaderBase.ts +++ b/base/ReaderBase.ts @@ -14,6 +14,10 @@ export class ReaderBase { return this.offset; } + public get length() { + return this.buffer.length; + } + public readBuffer(bytes:number) { const value = this.buffer.subarray(this.offset, this.offset + bytes); this.offset += bytes; diff --git a/base/WriterBase.ts b/base/WriterBase.ts index e1eb36c..b9b0436 100644 --- a/base/WriterBase.ts +++ b/base/WriterBase.ts @@ -14,6 +14,14 @@ export class WriterBase { this.resizable = size === 0; } + public get writeOffset() { + return this.offset; + } + + public get length() { + return this.buffer.length; + } + public toBuffer() { return this.buffer; } diff --git a/package.json b/package.json index 2f7c6b1..ec87111 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bufferstuff", - "version": "1.4.0", + "version": "1.4.1", "description": "A set of utility classes for reading and writing binary data in NodeJS and the browser", "main": "./lib/index.js", "types": "./lib/index.d.ts",