Hi there,

is there any way to create a File object from a buffer without writing it first to disk?
I want to use this for multimedia/game application with the Audio and Canvas modules.

Greetings

Hi Steven,

What will contain the buffer data ? Images and sounds ?

Hello Samir,

this was the plan.
I want to buffer = Zip.read("img/background.png") some image and use Canvas:Image(buffer) to make use of it.
The key thing here is that I don't want to extract the files to disk, instead using them directly.

It would be nice to have something like sys.File.from_buffer(buffer) or have functions/methods that use sys.File as argument also use a Buffer.

EDIT: I had a quick look in module sources, maybe it is difficult when all function calls just use filenames and not FILE*.

Yes it'might be difficult to implement but I will see what can be done.

Until then, you can extract files to the Windows tempdir and load sounds and images from there

Powered by: FreeFlarum.
(remove this footer)