In Roku, how do I read and write data from a temporary file in the folder tmp:
? I cannot find any documentation relating to this. The data which I am storing is too big to be stored in the registry.
Asked
Active
Viewed 2,140 times
6

khateeb
- 5,265
- 15
- 58
- 114
1 Answers
8
There is two simple functions do read and write data from tmp:/
folder:
ReadAsciiFile(filepath as String) as String
text=ReadAsciiFile("tmp:/config.txt")
WriteAsciiFile(filepath as String, text as String) as Boolean
WriteAsciiFile("tmp:/config.txt", "the text to write")
Further documentation in source.

Roberto14
- 689
- 6
- 20
-
I know that this is the solution (according to Roku), but this doesn't work for me. – Alejandro Cotilla Mar 07 '16 at 15:35
-
I take that back, the problem was that I was trying to access this from an SceneGraph object, and this can be accessed only from the main.brs file (apparently). – Alejandro Cotilla Mar 07 '16 at 19:31
-
Where should I place my file if I want to retain the file across the sessions? – MayurK Jul 12 '16 at 05:18
-
2@MayurK In that case I would suggest to store it in the Registry. You just need to "stringify" your file and save it. Be aware that Registry data size is limited to 16kb for each channel. – Roberto14 Jul 12 '16 at 07:46
-
Hi @Roberto14! Yes.. I did not use "stringify" but just stored my string. I forgot to reply here. Anyways Thanks for your answer :). – MayurK Jul 12 '16 at 08:15
-
I write my file in a task node using `m.LocalFile = CreateObject("roByteArray") m.LocalFile.FromAsciiString(m.Content) m.LocalFile.WriteFile("tmp:/interlink")`. I tried to this same file read main scene using `m.Content = ReadAsciiFile("tmp:/interlink")` It's give error `m.LocalM3U8File.FromAsciiString(m.M3U8Content)`. I don't know how?. any suggesion for this – Nikunj Chaklasiya Jan 28 '20 at 09:15