hi there, i have some binary data (zip files, music, etc..)stored in a database, how can i start those files in memory without saving them to HDD..or even to temp files folder...

thanks.

Recommended Answers

All 3 Replies

No, you have to save it to a temp file.

You can't expect software to be able to read your program's memory.

If your OS is linux, you should be able to store your file in /dev/shm which is a virtual directory which exists only in shared memory. Example

>>> f = open("/dev/shm/foo.txt", "w")
>>> f.write("hello world\n")
>>> f.close()
>>> f = open("/dev/shm/foo.txt", "r")
>>> print f.read()
hello world

>>> f.close()
>>> import os
>>> os.remove("/dev/shm/foo.txt")
# if we don't remove the file, it will be removed when we shutdown the computer.

Another way to do it is to run a live linux CD and disable swap.

ok guys, thanks a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.