Facepunch / garrysmod-requests

Feature requests for Garry's Mod
83 stars 24 forks source link

wrap some form of stream writer #1154

Open TheFreezebug opened 6 years ago

TheFreezebug commented 6 years ago

For parsing binary data in glua it would be pretty nice to have a stream reader / writer that's housed in ram :p.

It's slow having to write content to the disk then use file.Open on it. Basically, it'd be nice to have the same implementation the file.Open object has, except the stream it's writing to is in memory instead.

Kefta commented 6 years ago

https://github.com/Facepunch/garrysmod-requests/issues/594 would pretty much solve this. Any kind of generic stream reader and writer would be great..

robotboy655 commented 6 years ago

Here's a question: What binary data are you unable to currently parse? Something from an external online file acquired via HTTP and its library?

thegrb93 commented 6 years ago

Would greatly improve Advdupe2 because it uses a temp file right now for binary operations.

robotboy655 commented 6 years ago

What "binary operations" does it do?

thegrb93 commented 6 years ago

Here it is, https://github.com/wiremod/advdupe2/blob/f68c4b903c3a9b3e9be92897fdebf6e2749d7d27/lua/advdupe2/sh_codec.lua

Kefta commented 6 years ago

I'd use it for reading Quake WADs and Goldsrc BSPs, which currently requires writing everything to a file and thus is super slow.

Also string builders.