unpak.js
Version:
Modern TypeScript library for reading Unreal Engine pak files and assets, inspired by CUE4Parse
128 lines • 2.77 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FArchiveProxy = void 0;
const FArchive_1 = require("./FArchive");
/**
* Proxy for UE4 Generic Reader
*/
class FArchiveProxy extends FArchive_1.FArchive {
wrappedAr;
/**
* Whether to use little endian order
* @type {boolean}
* @public
*/
get littleEndian() {
return this.wrappedAr.littleEndian;
}
set littleEndian(value) {
this.wrappedAr.littleEndian = value;
}
/**
* Creates an instance
* @param {FArchive} wrappedAr Ar to proxy
* @constructor
* @public
*/
constructor(wrappedAr) {
super();
this.wrappedAr = wrappedAr;
}
/**
* Clones this
* @returns {FArchiveProxy} Clone
* @public
*/
clone() {
return new FArchiveProxy(this.wrappedAr);
}
/**
* Size of data
* @type {number}
* @public
*/
get size() {
return this.wrappedAr.size;
}
/**
* Current position
* @type {number}
* @public
*/
get pos() {
return this.wrappedAr.pos;
}
set pos(pos) {
this.wrappedAr.pos = pos;
}
/**
* Reads to a buffer
* @param {Buffer} b Destination
* @param {number} off Offset
* @param {number} len Length
* @returns {void}
* @public
*/
readToBuffer(b, off = 0, len = b.length) {
return this.wrappedAr.readToBuffer(b, off, len);
}
/**
* Returns FArchive info for error
* @returns {string}
* @public
*/
printError() {
return this.wrappedAr.printError();
}
// Overriding these to keep optimal performance with FByteArchive
/**
* Reads an 8-bit integer
* @returns {number} Result
* @public
*/
readInt8() {
return this.wrappedAr.readInt8();
}
/**
* Reads a 16-bit integer
* @returns {number} Result
* @public
*/
readInt16() {
return this.wrappedAr.readInt16();
}
/**
* Reads a 32-bit integer
* @returns {number} Result
* @public
*/
readInt32() {
return this.wrappedAr.readInt32();
}
/**
* Reads a 64-bit integer
* @returns {bigint} Result
* @public
*/
readInt64() {
return this.wrappedAr.readInt64();
}
/**
* Reads a 32-bit float
* @returns {number} Result
* @public
*/
readFloat32() {
return this.wrappedAr.readFloat32();
}
/**
* Reads a double
* @returns {number} Result
* @public
*/
readDouble() {
return this.wrappedAr.readDouble();
}
}
exports.FArchiveProxy = FArchiveProxy;
//# sourceMappingURL=FArchiveProxy.js.map