the 2nd parameter wants to be the offset, and 3rd seems to be ignored
*2nd parameter in read()
that's for types
which are constucted with JS array syntax
so you should do like read(['string', length])
Hello! Sorry for awaking the old thread, but I've recently started using jBinary, and it's the best binary parsing/generating thing I've found on the net. So I'm using it a lot in making my game modding toolset. Have a noob question though: what is the best way to write file from data object? Is there a way to construct jBinary without preallocating the buffer large enough?
@kabbi Glad you like it so far! As for the file, unfortunately, yes, you need to serialize data into a binary blob first and then write it to a file. If you have an array of smaller data chunks, you can represent them as a series of jBinary instances to decrease memory usage, but otherwise no good method to serialize directly at the moment (contributions are welcome though).
@RReverser Okay, thank you. I may think of something, but I currently have no idea, except for some auto-expanding buffer mode.