lua-cmsgpack
lua-cmsgpack copied to clipboard
Support reading from FILE*
I have a large chunk of data in a file, encoded with msgpack, and I want to load it to Lua.
I do not want to pay for overhead of interning this file as a string into Lua state. Instead I want a lua-cmsgpack call that would load my data from file directly.
Is it possible?
I realize that this is somewhat a corner case for lua-cmsgpack, as it is persistence and not message passing, but anyway — would be quite useful.
This (i.e. msgpack.unpack_from_file("filename")) should be easily doable with memory mapped files BTW.
@agladysh try: msgpack.unpack( io.open('filename', 'rb'):read('*all') )