Allow getting of the read offset (needed for mc-beta-server)

This commit is contained in:
Holly Stubbs 2023-11-07 00:01:33 +00:00
parent 3bb2f542ef
commit 63a3e5c73b
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E
3 changed files with 60 additions and 37 deletions

View file

@ -10,6 +10,10 @@ export class ReaderBase {
this.offset = 0;
}
public get readOffset() {
return this.offset;
}
public readBuffer(bytes:number) {
const value = this.buffer.subarray(this.offset, this.offset + bytes);
this.offset += bytes;

83
package-lock.json generated
View file

@ -1,20 +1,20 @@
{
"name": "bufferstuff",
"version": "1.3.4",
"version": "1.4.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "bufferstuff",
"version": "1.3.4",
"version": "1.4.0",
"license": "MIT",
"devDependencies": {
"check-outdated": "^2.11.0",
"check-outdated": "^2.12.0",
"npm-run-all": "^4.1.5",
"terser": "^5.22.0",
"ts-loader": "^9.4.4",
"terser": "^5.24.0",
"ts-loader": "^9.5.0",
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
"typescript": "^5.2.2"
}
},
"node_modules/@cspotcode/source-map-support": {
@ -547,9 +547,9 @@
}
},
"node_modules/check-outdated": {
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/check-outdated/-/check-outdated-2.11.0.tgz",
"integrity": "sha512-YZmbRlpWCi2plPRpKLNPJLeel+86qvHMK1Tt9Dpt/APjtSCDrI9YpMvXr4lGrsx8aH0QJev7VJUyfcfwKQ/CCg==",
"version": "2.12.0",
"resolved": "https://registry.npmjs.org/check-outdated/-/check-outdated-2.12.0.tgz",
"integrity": "sha512-kWThJFiqxAE09XSNJLLD4hWNvLhWdxFLKxOHhxB+XhGlZGyeELXP8V6R/dRrZ5vbjmp9VmoTYe0vp6egftKz7Q==",
"dev": true,
"bin": {
"check-outdated": "check-outdated.js"
@ -2052,9 +2052,9 @@
}
},
"node_modules/terser": {
"version": "5.22.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.22.0.tgz",
"integrity": "sha512-hHZVLgRA2z4NWcN6aS5rQDc+7Dcy58HOf2zbYwmFcQ+ua3h6eEFf5lIDKTzbWwlazPyOZsFQO8V80/IjVNExEw==",
"version": "5.24.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.24.0.tgz",
"integrity": "sha512-ZpGR4Hy3+wBEzVEnHvstMvqpD/nABNelQn/z2r0fjVWGQsN3bpOLzQlqDxmb4CDZnXq5lpjnQ+mHQLAOpfM5iw==",
"dev": true,
"dependencies": {
"@jridgewell/source-map": "^0.3.3",
@ -2145,15 +2145,16 @@
}
},
"node_modules/ts-loader": {
"version": "9.4.4",
"resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.4.tgz",
"integrity": "sha512-MLukxDHBl8OJ5Dk3y69IsKVFRA/6MwzEqBgh+OXMPB/OD01KQuWPFd1WAQP8a5PeSCAxfnkhiuWqfmFJzJQt9w==",
"version": "9.5.0",
"resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.0.tgz",
"integrity": "sha512-LLlB/pkB4q9mW2yLdFMnK3dEHbrBjeZTYguaaIfusyojBgAGf5kF+O6KcWqiGzWqHk0LBsoolrp4VftEURhybg==",
"dev": true,
"dependencies": {
"chalk": "^4.1.0",
"enhanced-resolve": "^5.0.0",
"micromatch": "^4.0.0",
"semver": "^7.3.4"
"semver": "^7.3.4",
"source-map": "^0.7.4"
},
"engines": {
"node": ">=12.0.0"
@ -2163,6 +2164,15 @@
"webpack": "^5.0.0"
}
},
"node_modules/ts-loader/node_modules/source-map": {
"version": "0.7.4",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz",
"integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==",
"dev": true,
"engines": {
"node": ">= 8"
}
},
"node_modules/ts-node": {
"version": "10.9.1",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
@ -2221,9 +2231,9 @@
}
},
"node_modules/typescript": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
"integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
"integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@ -2886,9 +2896,9 @@
}
},
"check-outdated": {
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/check-outdated/-/check-outdated-2.11.0.tgz",
"integrity": "sha512-YZmbRlpWCi2plPRpKLNPJLeel+86qvHMK1Tt9Dpt/APjtSCDrI9YpMvXr4lGrsx8aH0QJev7VJUyfcfwKQ/CCg==",
"version": "2.12.0",
"resolved": "https://registry.npmjs.org/check-outdated/-/check-outdated-2.12.0.tgz",
"integrity": "sha512-kWThJFiqxAE09XSNJLLD4hWNvLhWdxFLKxOHhxB+XhGlZGyeELXP8V6R/dRrZ5vbjmp9VmoTYe0vp6egftKz7Q==",
"dev": true
},
"chrome-trace-event": {
@ -4012,9 +4022,9 @@
"dev": true
},
"terser": {
"version": "5.22.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.22.0.tgz",
"integrity": "sha512-hHZVLgRA2z4NWcN6aS5rQDc+7Dcy58HOf2zbYwmFcQ+ua3h6eEFf5lIDKTzbWwlazPyOZsFQO8V80/IjVNExEw==",
"version": "5.24.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.24.0.tgz",
"integrity": "sha512-ZpGR4Hy3+wBEzVEnHvstMvqpD/nABNelQn/z2r0fjVWGQsN3bpOLzQlqDxmb4CDZnXq5lpjnQ+mHQLAOpfM5iw==",
"dev": true,
"requires": {
"@jridgewell/source-map": "^0.3.3",
@ -4074,15 +4084,24 @@
}
},
"ts-loader": {
"version": "9.4.4",
"resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.4.tgz",
"integrity": "sha512-MLukxDHBl8OJ5Dk3y69IsKVFRA/6MwzEqBgh+OXMPB/OD01KQuWPFd1WAQP8a5PeSCAxfnkhiuWqfmFJzJQt9w==",
"version": "9.5.0",
"resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.0.tgz",
"integrity": "sha512-LLlB/pkB4q9mW2yLdFMnK3dEHbrBjeZTYguaaIfusyojBgAGf5kF+O6KcWqiGzWqHk0LBsoolrp4VftEURhybg==",
"dev": true,
"requires": {
"chalk": "^4.1.0",
"enhanced-resolve": "^5.0.0",
"micromatch": "^4.0.0",
"semver": "^7.3.4"
"semver": "^7.3.4",
"source-map": "^0.7.4"
},
"dependencies": {
"source-map": {
"version": "0.7.4",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz",
"integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==",
"dev": true
}
}
},
"ts-node": {
@ -4118,9 +4137,9 @@
}
},
"typescript": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
"integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
"integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
"dev": true
},
"unbox-primitive": {

View file

@ -1,6 +1,6 @@
{
"name": "bufferstuff",
"version": "1.3.4",
"version": "1.4.0",
"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",
@ -30,11 +30,11 @@
},
"homepage": "https://github.com/tgpholly/bufferStuff#readme",
"devDependencies": {
"check-outdated": "^2.11.0",
"check-outdated": "^2.12.0",
"npm-run-all": "^4.1.5",
"terser": "^5.22.0",
"ts-loader": "^9.4.4",
"terser": "^5.24.0",
"ts-loader": "^9.5.0",
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
"typescript": "^5.2.2"
}
}