From b1596e1c45585a382f76cf5250da05494b132be0 Mon Sep 17 00:00:00 2001 From: Holly Date: Fri, 12 May 2023 14:41:35 +0100 Subject: [PATCH] delete ^& ignore lib --- .gitignore | 3 + .npmignore | 130 ++++++++++++++++++++++++++++++++++++ lib/index.d.ts | 9 --- lib/index.js | 30 --------- lib/readers/IReader.d.ts | 19 ------ lib/readers/IReader.js | 2 - lib/readers/ReaderBE.d.ts | 15 ----- lib/readers/ReaderBE.js | 71 -------------------- lib/readers/ReaderBase.d.ts | 11 --- lib/readers/ReaderBase.js | 38 ----------- lib/readers/ReaderLE.d.ts | 15 ----- lib/readers/ReaderLE.js | 71 -------------------- lib/writers/IWriter.d.ts | 21 ------ lib/writers/IWriter.js | 2 - lib/writers/WriterBE.d.ts | 15 ----- lib/writers/WriterBE.js | 130 ------------------------------------ lib/writers/WriterBase.d.ts | 14 ---- lib/writers/WriterBase.js | 56 ---------------- lib/writers/WriterLE.d.ts | 15 ----- lib/writers/WriterLE.js | 130 ------------------------------------ package-lock.json | 4 +- 21 files changed, 135 insertions(+), 666 deletions(-) create mode 100644 .npmignore delete mode 100644 lib/index.d.ts delete mode 100644 lib/index.js delete mode 100644 lib/readers/IReader.d.ts delete mode 100644 lib/readers/IReader.js delete mode 100644 lib/readers/ReaderBE.d.ts delete mode 100644 lib/readers/ReaderBE.js delete mode 100644 lib/readers/ReaderBase.d.ts delete mode 100644 lib/readers/ReaderBase.js delete mode 100644 lib/readers/ReaderLE.d.ts delete mode 100644 lib/readers/ReaderLE.js delete mode 100644 lib/writers/IWriter.d.ts delete mode 100644 lib/writers/IWriter.js delete mode 100644 lib/writers/WriterBE.d.ts delete mode 100644 lib/writers/WriterBE.js delete mode 100644 lib/writers/WriterBase.d.ts delete mode 100644 lib/writers/WriterBase.js delete mode 100644 lib/writers/WriterLE.d.ts delete mode 100644 lib/writers/WriterLE.js diff --git a/.gitignore b/.gitignore index c6bba59..9010735 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Build folder +lib/ + # Logs logs *.log diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..c6bba59 --- /dev/null +++ b/.npmignore @@ -0,0 +1,130 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp +.cache + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* diff --git a/lib/index.d.ts b/lib/index.d.ts deleted file mode 100644 index f1a08b2..0000000 --- a/lib/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// -import { IReader } from "./readers/IReader"; -import { IWriter } from "./writers/IWriter"; -export declare enum Endian { - LE = 0, - BE = 1 -} -export declare function createReader(endianness: Endian, buffer: Buffer): IReader; -export declare function createWriter(endianness: Endian, size?: number): IWriter; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 9714766..0000000 --- a/lib/index.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createWriter = exports.createReader = exports.Endian = void 0; -const ReaderBE_1 = require("./readers/ReaderBE"); -const ReaderLE_1 = require("./readers/ReaderLE"); -const WriterBE_1 = require("./writers/WriterBE"); -const WriterLE_1 = require("./writers/WriterLE"); -var Endian; -(function (Endian) { - Endian[Endian["LE"] = 0] = "LE"; - Endian[Endian["BE"] = 1] = "BE"; -})(Endian = exports.Endian || (exports.Endian = {})); -function createReader(endianness, buffer) { - if (endianness === Endian.LE) { - return new ReaderLE_1.ReaderLE(buffer); - } - else { - return new ReaderBE_1.ReaderBE(buffer); - } -} -exports.createReader = createReader; -function createWriter(endianness, size) { - if (endianness === Endian.LE) { - return new WriterLE_1.WriterLE(size); - } - else { - return new WriterBE_1.WriterBE(size); - } -} -exports.createWriter = createWriter; diff --git a/lib/readers/IReader.d.ts b/lib/readers/IReader.d.ts deleted file mode 100644 index 311c505..0000000 --- a/lib/readers/IReader.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/// -export interface IReader { - readBuffer(bytes: number): Buffer; - readUint8Array(bytes: number): Uint8Array; - readByte(): number; - readUByte(): number; - readBool(): boolean; - readShort(): number; - readUShort(): number; - readInt(): number; - readUInt(): number; - readLong(): bigint; - readULong(): bigint; - readFloat(): number; - readDouble(): number; - readShortString(): string; - readString(): string; - readString16(): string; -} diff --git a/lib/readers/IReader.js b/lib/readers/IReader.js deleted file mode 100644 index c8ad2e5..0000000 --- a/lib/readers/IReader.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/readers/ReaderBE.d.ts b/lib/readers/ReaderBE.d.ts deleted file mode 100644 index 528cc2d..0000000 --- a/lib/readers/ReaderBE.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { IReader } from "./IReader"; -import { ReaderBase } from "./ReaderBase"; -export declare class ReaderBE extends ReaderBase implements IReader { - readShort(): number; - readUShort(): number; - readInt(): number; - readUInt(): number; - readLong(): bigint; - readULong(): bigint; - readFloat(): number; - readDouble(): number; - readShortString(): string; - readString(): string; - readString16(): string; -} diff --git a/lib/readers/ReaderBE.js b/lib/readers/ReaderBE.js deleted file mode 100644 index 4d35167..0000000 --- a/lib/readers/ReaderBE.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ReaderBE = void 0; -const ReaderBase_1 = require("./ReaderBase"); -class ReaderBE extends ReaderBase_1.ReaderBase { - readShort() { - const value = this.buffer.readInt16BE(this.offset); - this.offset += 2; - return value; - } - readUShort() { - const value = this.buffer.readUInt16BE(this.offset); - this.offset += 2; - return value; - } - readInt() { - const value = this.buffer.readInt32BE(this.offset); - this.offset += 4; - return value; - } - readUInt() { - const value = this.buffer.readUInt32BE(this.offset); - this.offset += 4; - return value; - } - readLong() { - const value = this.buffer.readBigInt64BE(this.offset); - this.offset += 8; - return value; - } - readULong() { - const value = this.buffer.readBigUint64BE(this.offset); - this.offset += 8; - return value; - } - readFloat() { - const value = this.buffer.readFloatBE(this.offset); - this.offset += 4; - return value; - } - readDouble() { - const value = this.buffer.readDoubleBE(this.offset); - this.offset += 8; - return value; - } - readShortString() { - const length = this.readUByte(); - let text = ""; - for (let i = 0; i < length; i++) { - text += String.fromCharCode(this.readUByte()); - } - return text; - } - readString() { - const length = this.readUShort(); - let text = ""; - for (let i = 0; i < length; i++) { - text += String.fromCharCode(this.readUByte()); - } - return text; - } - readString16() { - const length = this.readUShort(); - let text = ""; - for (let i = 0; i < length; i++) { - text += String.fromCharCode(this.readUShort()); - } - return text; - } -} -exports.ReaderBE = ReaderBE; diff --git a/lib/readers/ReaderBase.d.ts b/lib/readers/ReaderBase.d.ts deleted file mode 100644 index aafdc96..0000000 --- a/lib/readers/ReaderBase.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// -export declare class ReaderBase { - buffer: Buffer; - offset: number; - constructor(buffer: Buffer); - readBuffer(bytes: number): Buffer; - readUint8Array(bytes: number): Uint8Array; - readByte(): number; - readUByte(): number; - readBool(): boolean; -} diff --git a/lib/readers/ReaderBase.js b/lib/readers/ReaderBase.js deleted file mode 100644 index 706304a..0000000 --- a/lib/readers/ReaderBase.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ReaderBase = void 0; -class ReaderBase { - constructor(buffer) { - this.buffer = buffer; - this.offset = 0; - } - readBuffer(bytes) { - const value = this.buffer.subarray(this.offset, this.offset + bytes); - this.offset += bytes; - return value; - } - // NOTE: This has to be a copy as the subarray is only cropped & offset - // Realistically this is what we want anyway. - readUint8Array(bytes) { - const croppedBuffer = this.readBuffer(bytes); - const newArray = new Uint8Array(croppedBuffer.length); - for (let i = 0; i < croppedBuffer.length; i++) { - newArray[i] = croppedBuffer[i]; - } - return newArray; - } - readByte() { - const value = this.buffer.readInt8(this.offset); - this.offset++; - return value; - } - readUByte() { - const value = this.buffer.readUInt8(this.offset); - this.offset++; - return value; - } - readBool() { - return Boolean(this.readUByte()); - } -} -exports.ReaderBase = ReaderBase; diff --git a/lib/readers/ReaderLE.d.ts b/lib/readers/ReaderLE.d.ts deleted file mode 100644 index b59c151..0000000 --- a/lib/readers/ReaderLE.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { IReader } from "./IReader"; -import { ReaderBase } from "./ReaderBase"; -export declare class ReaderLE extends ReaderBase implements IReader { - readShort(): number; - readUShort(): number; - readInt(): number; - readUInt(): number; - readLong(): bigint; - readULong(): bigint; - readFloat(): number; - readDouble(): number; - readShortString(): string; - readString(): string; - readString16(): string; -} diff --git a/lib/readers/ReaderLE.js b/lib/readers/ReaderLE.js deleted file mode 100644 index cca6625..0000000 --- a/lib/readers/ReaderLE.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ReaderLE = void 0; -const ReaderBase_1 = require("./ReaderBase"); -class ReaderLE extends ReaderBase_1.ReaderBase { - readShort() { - const value = this.buffer.readInt16LE(this.offset); - this.offset += 2; - return value; - } - readUShort() { - const value = this.buffer.readUInt16LE(this.offset); - this.offset += 2; - return value; - } - readInt() { - const value = this.buffer.readInt32LE(this.offset); - this.offset += 4; - return value; - } - readUInt() { - const value = this.buffer.readUInt32LE(this.offset); - this.offset += 4; - return value; - } - readLong() { - const value = this.buffer.readBigInt64LE(this.offset); - this.offset += 8; - return value; - } - readULong() { - const value = this.buffer.readBigUint64LE(this.offset); - this.offset += 8; - return value; - } - readFloat() { - const value = this.buffer.readFloatLE(this.offset); - this.offset += 4; - return value; - } - readDouble() { - const value = this.buffer.readDoubleLE(this.offset); - this.offset += 8; - return value; - } - readShortString() { - const length = this.readUByte(); - let text = ""; - for (let i = 0; i < length; i++) { - text += String.fromCharCode(this.readUByte()); - } - return text; - } - readString() { - const length = this.readUShort(); - let text = ""; - for (let i = 0; i < length; i++) { - text += String.fromCharCode(this.readUByte()); - } - return text; - } - readString16() { - const length = this.readUShort(); - let text = ""; - for (let i = 0; i < length; i++) { - text += String.fromCharCode(this.readUShort()); - } - return text; - } -} -exports.ReaderLE = ReaderLE; diff --git a/lib/writers/IWriter.d.ts b/lib/writers/IWriter.d.ts deleted file mode 100644 index f9f0f23..0000000 --- a/lib/writers/IWriter.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// -export interface IWriter { - toBuffer(): Buffer; - toString(): string; - writeBuffer(buffer: Buffer): IWriter; - writeUint8Array(array: Uint8Array): IWriter; - writeByte(value: number): IWriter; - writeUByte(value: number): IWriter; - writeBool(value: boolean | number): IWriter; - writeShort(value: number): IWriter; - writeUShort(value: number): IWriter; - writeInt(value: number): IWriter; - writeUInt(value: number): IWriter; - writeLong(value: number | bigint): IWriter; - writeULong(value: number): IWriter; - writeFloat(value: number): IWriter; - writeDouble(value: number): IWriter; - writeShortString(text: string): IWriter; - writeString(text: string): IWriter; - writeString16(text: string): IWriter; -} diff --git a/lib/writers/IWriter.js b/lib/writers/IWriter.js deleted file mode 100644 index c8ad2e5..0000000 --- a/lib/writers/IWriter.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/writers/WriterBE.d.ts b/lib/writers/WriterBE.d.ts deleted file mode 100644 index 9b3069b..0000000 --- a/lib/writers/WriterBE.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { IWriter } from "./IWriter"; -import { WriterBase } from "./WriterBase"; -export declare class WriterBE extends WriterBase implements IWriter { - writeShort(value: number): this; - writeUShort(value: number): this; - writeInt(value: number): this; - writeUInt(value: number): this; - writeLong(value: number | bigint): this; - writeULong(value: number | bigint): this; - writeFloat(value: number): this; - writeDouble(value: number): this; - writeShortString(text: string): this; - writeString(text: string): this; - writeString16(text: string): this; -} diff --git a/lib/writers/WriterBE.js b/lib/writers/WriterBE.js deleted file mode 100644 index a23a44b..0000000 --- a/lib/writers/WriterBE.js +++ /dev/null @@ -1,130 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WriterBE = void 0; -const WriterBase_1 = require("./WriterBase"); -class WriterBE extends WriterBase_1.WriterBase { - writeShort(value) { - if (this.resizable) { - const buffer = Buffer.alloc(2); - buffer.writeInt16BE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeInt16BE(value, this.offset); - this.offset += 2; - } - return this; - } - writeUShort(value) { - if (this.resizable) { - const buffer = Buffer.alloc(2); - buffer.writeUInt16BE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeUInt16BE(value, this.offset); - this.offset += 2; - } - return this; - } - writeInt(value) { - if (this.resizable) { - const buffer = Buffer.alloc(4); - buffer.writeInt32BE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeInt32BE(value, this.offset); - this.offset += 4; - } - return this; - } - writeUInt(value) { - if (this.resizable) { - const buffer = Buffer.alloc(4); - buffer.writeUInt32BE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeUInt32BE(value, this.offset); - this.offset += 4; - } - return this; - } - writeLong(value) { - if (typeof (value) !== "bigint") { - value = BigInt(value); - } - if (this.resizable) { - const buffer = Buffer.alloc(8); - buffer.writeBigInt64BE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeBigInt64BE(value, this.offset); - this.offset += 8; - } - return this; - } - writeULong(value) { - if (typeof (value) !== "bigint") { - value = BigInt(value); - } - if (this.resizable) { - const buffer = Buffer.alloc(8); - buffer.writeBigUint64BE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeBigUint64BE(value, this.offset); - this.offset += 8; - } - return this; - } - writeFloat(value) { - if (this.resizable) { - const buffer = Buffer.alloc(4); - buffer.writeFloatBE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeFloatBE(value, this.offset); - this.offset += 4; - } - return this; - } - writeDouble(value) { - if (this.resizable) { - const buffer = Buffer.alloc(8); - buffer.writeDoubleBE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeDoubleBE(value, this.offset); - this.offset += 8; - } - return this; - } - writeShortString(text) { - this.writeUByte(text.length); - for (let i = 0; i < text.length; i++) { - this.writeUByte(text.charCodeAt(i)); - } - return this; - } - writeString(text) { - this.writeUShort(text.length); - for (let i = 0; i < text.length; i++) { - this.writeUByte(text.charCodeAt(i)); - } - return this; - } - writeString16(text) { - this.writeUShort(text.length); - for (let i = 0; i < text.length; i++) { - this.writeUShort(text.charCodeAt(i)); - } - return this; - } -} -exports.WriterBE = WriterBE; diff --git a/lib/writers/WriterBase.d.ts b/lib/writers/WriterBase.d.ts deleted file mode 100644 index 87599f9..0000000 --- a/lib/writers/WriterBase.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// -export declare class WriterBase { - buffer: Buffer; - offset: number; - readonly resizable: boolean; - constructor(size?: number); - toBuffer(): Buffer; - toString(): string; - writeBuffer(buffer: Buffer): this; - writeUint8Array(array: Uint8Array): this; - writeByte(value: number): this; - writeUByte(value: number): this; - writeBool(value: boolean | number): this; -} diff --git a/lib/writers/WriterBase.js b/lib/writers/WriterBase.js deleted file mode 100644 index 3c80864..0000000 --- a/lib/writers/WriterBase.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WriterBase = void 0; -class WriterBase { - constructor(size = 0) { - this.buffer = Buffer.alloc(size); - this.offset = 0; - this.resizable = size === 0; - } - toBuffer() { - return this.buffer; - } - toString() { - return this.buffer.toString(); - } - writeBuffer(buffer) { - this.buffer = Buffer.concat([this.buffer, buffer], this.buffer.length + buffer.length); - return this; - } - writeUint8Array(array) { - this.writeBuffer(Buffer.from(array)); - return this; - } - writeByte(value) { - if (this.resizable) { - const buffer = Buffer.alloc(1); - buffer.writeInt8(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeInt8(value, this.offset); - this.offset++; - } - return this; - } - writeUByte(value) { - if (this.resizable) { - const buffer = Buffer.alloc(1); - buffer.writeUInt8(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeUInt8(value, this.offset); - this.offset++; - } - return this; - } - writeBool(value) { - if (typeof (value) === "number") { - value = Boolean(value); - } - this.writeUByte(value ? 1 : 0); - return this; - } -} -exports.WriterBase = WriterBase; diff --git a/lib/writers/WriterLE.d.ts b/lib/writers/WriterLE.d.ts deleted file mode 100644 index 1f9cd06..0000000 --- a/lib/writers/WriterLE.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { IWriter } from "./IWriter"; -import { WriterBase } from "./WriterBase"; -export declare class WriterLE extends WriterBase implements IWriter { - writeShort(value: number): this; - writeUShort(value: number): this; - writeInt(value: number): this; - writeUInt(value: number): this; - writeLong(value: number | bigint): this; - writeULong(value: number | bigint): this; - writeFloat(value: number): this; - writeDouble(value: number): this; - writeShortString(text: string): this; - writeString(text: string): this; - writeString16(text: string): this; -} diff --git a/lib/writers/WriterLE.js b/lib/writers/WriterLE.js deleted file mode 100644 index 279ea39..0000000 --- a/lib/writers/WriterLE.js +++ /dev/null @@ -1,130 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WriterLE = void 0; -const WriterBase_1 = require("./WriterBase"); -class WriterLE extends WriterBase_1.WriterBase { - writeShort(value) { - if (this.resizable) { - const buffer = Buffer.alloc(2); - buffer.writeInt16LE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeInt16LE(value, this.offset); - this.offset += 2; - } - return this; - } - writeUShort(value) { - if (this.resizable) { - const buffer = Buffer.alloc(2); - buffer.writeUInt16LE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeUInt16LE(value, this.offset); - this.offset += 2; - } - return this; - } - writeInt(value) { - if (this.resizable) { - const buffer = Buffer.alloc(4); - buffer.writeInt32LE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeInt32LE(value, this.offset); - this.offset += 4; - } - return this; - } - writeUInt(value) { - if (this.resizable) { - const buffer = Buffer.alloc(4); - buffer.writeUInt32LE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeUInt32LE(value, this.offset); - this.offset += 4; - } - return this; - } - writeLong(value) { - if (typeof (value) !== "bigint") { - value = BigInt(value); - } - if (this.resizable) { - const buffer = Buffer.alloc(8); - buffer.writeBigInt64LE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeBigInt64LE(value, this.offset); - this.offset += 8; - } - return this; - } - writeULong(value) { - if (typeof (value) !== "bigint") { - value = BigInt(value); - } - if (this.resizable) { - const buffer = Buffer.alloc(8); - buffer.writeBigUint64LE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeBigUint64LE(value, this.offset); - this.offset += 8; - } - return this; - } - writeFloat(value) { - if (this.resizable) { - const buffer = Buffer.alloc(4); - buffer.writeFloatLE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeFloatLE(value, this.offset); - this.offset += 4; - } - return this; - } - writeDouble(value) { - if (this.resizable) { - const buffer = Buffer.alloc(8); - buffer.writeDoubleLE(value); - this.writeBuffer(buffer); - } - else { - this.buffer.writeDoubleLE(value, this.offset); - this.offset += 8; - } - return this; - } - writeShortString(text) { - this.writeUByte(text.length); - for (let i = 0; i < text.length; i++) { - this.writeUByte(text.charCodeAt(i)); - } - return this; - } - writeString(text) { - this.writeUShort(text.length); - for (let i = 0; i < text.length; i++) { - this.writeUByte(text.charCodeAt(i)); - } - return this; - } - writeString16(text) { - this.writeUShort(text.length); - for (let i = 0; i < text.length; i++) { - this.writeUShort(text.charCodeAt(i)); - } - return this; - } -} -exports.WriterLE = WriterLE; diff --git a/package-lock.json b/package-lock.json index 6beb259..25d819f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bufferstuff", - "version": "1.0.0", + "version": "1.1.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "bufferstuff", - "version": "1.0.0", + "version": "1.1.2", "license": "MIT", "devDependencies": { "check-outdated": "^2.11.0",