Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

WriteFile and AppendFile

I realize it's a little late in the game but the BRS functions WriteFile() and AppendFile() leave a little to be desired.
WriteFile() replaces the WHOLE file but it does allow for partial buffer transfers.
AppendFile() does move the data to the end of the file BUT it transfers the entire buffer. There is no partial buffer transfer.

You should be able to do this:
buf.WriteFile( "tmp:/somefile" , 0, 100 )
buf.WriteFile( "tmp:/somefile" , 0, 100 ) <-------- need to append like a normal write
buf.WriteFile( "tmp:/somefile" , 0, 100 )
and end up with a file of 300 characters.

Or this:
buf.WriteFile( "tmp:/somefile" , 0, 100 )
buf.AppendFile( "tmp:/somefile" , 0, 100 ) <-------- need to allow start and length
buf.AppendFile( "tmp:/somefile" , 0, 100 )

Without either of these capabilities, it requires that you create a new "roByteArray" and copy
over the data a character at a time from the original buffer before doing an append. This produces a lot of overhead.
0 Kudos

Re: WriteFile and AppendFile

Good point. I have filed an enhancement request for this.

0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.