Skip to content

Commit

Permalink
add getOffset to DataStream
Browse files Browse the repository at this point in the history
  • Loading branch information
KurtThiemann committed Feb 23, 2024
1 parent 5f42f0d commit d8f64a7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "armarius-io",
"version": "1.1.0",
"version": "1.2.0",
"description": "IO and compression library for Armarius",
"repository": "github:aternosorg/armarius-io",
"type": "module",
Expand Down
12 changes: 12 additions & 0 deletions src/IO/DataStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,24 @@ export default class DataStream {
/**
* Get the final length of the data stream.
* Return null if the length is unknown.
*
* @return {?number}
* @abstract
*/
getFinalLength() {
}

/**
* Get the current offset within the data stream.
* (The number of bytes read so far since the stream was created/the last reset() call.)
*
* @return {number}
* @abstract
*/
getOffset() {

}

/**
* @return {Promise<this>}
* @abstract
Expand Down
7 changes: 7 additions & 0 deletions src/IO/IO.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,5 +280,12 @@ export default class IO extends DataStream {
getFinalLength() {
return this.byteLength;
}

/**
* @return {number}
*/
getOffset() {
return this.offset;
}
}

0 comments on commit d8f64a7

Please sign in to comment.