LS.WBin Class
WBin allows to create binary files easily (similar to WAD format). You can pack lots of resources in one file or extract them.
Item Index
Methods
WBin.create
-
origin
-
origin_class_name
Builds a WBin data stream from an object (every property of the object will be considered a lump with data) It supports Numbers, Strings and TypedArrays or ArrayBuffer
Parameters:
-
origin
Objectobject containing all the lumps, the key will be used as lump name
-
origin_class_name
String[Optional] allows to add a classname to the WBin, this is used to detect which class to instance when extracting it
Returns:
all the bytes
WBin.getHeaderInfo
-
data_array
Extract the header info from an ArrayBuffer (it contains version, and lumps info)
Parameters:
-
data_array
UInt8Array
Returns:
Header
WBin.isWBin
-
data
Allows to check if one Uint8Array contains a WBin file
Parameters:
-
data
UInt8Array
Returns:
WBin.load
-
data_array
-
skip_classname
-
filename
Extract the info from a Uint8Array containing WBin info and returns the object with all the lumps. If the data contains info about the class to instantiate, the WBin instantiates the class and passes the data to it
Parameters:
-
data_array
UInt8Array -
skip_classname
Boolavoid getting the instance of the class specified in classname, and get only the lumps
-
filename
String[optional] the filename where this wbin came from (important to mark resources)
Returns:
Could be an Object with all the lumps or an instance to the class specified in the WBin data