I wanted to know if io.open loads the whole file into memory? Or if it loads it into memory at all.
I am using network.download to save a video file “video.mp4” to the documents directory. But, I also need to allow the user to purge/delete this video file (or multiple files) but there is no direct way of doing that. So what I came up with is to save a small text file with the text “PURGED” but name it with the same name as the video file “video.mp4”.
So now a 30MB video file “video.mp4” is a 4K text file named “video.mp4”
This works great for me.
Now I want to check to see if video.mp4 is my dummy text file or the real thing, so I am looking to use io.open and file:read( 6 ) to read the first six characters of the file. BUT, if io.open loads the whole thing into memory and it happens to be the real video file I might run into some memory issues. Plus, I just dont want to load the whole file in.
So, does io.open just identify/prep the file to be read or does it actually load the whole thing in?
- davey [import]uid: 7845 topic_id: 12967 reply_id: 312967[/import]
