Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support reading from FILE* #14

Open
agladysh opened this issue Apr 4, 2012 · 2 comments
Open

Support reading from FILE* #14

agladysh opened this issue Apr 4, 2012 · 2 comments

Comments

@agladysh
Copy link
Contributor

agladysh commented Apr 4, 2012

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.

@agladysh
Copy link
Contributor Author

agladysh commented Apr 4, 2012

This (i.e. msgpack.unpack_from_file("filename")) should be easily doable with memory mapped files BTW.

@denisdemaisbr
Copy link

@agladysh
try: msgpack.unpack( io.open('filename', 'rb'):read('*all') )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants