Re: Learning OS.File

Neil <[email protected]> Thu, 18 Dec 2014 09:33:45 +0000
Newsgroups gmane.comp.mozilla.devel.xpfe
Message-ID <[email protected]>
[email protected] wrote:

>Why is the read operation converting the contents of the text file into 8-bit integers?
>  
>
Files contain 8-bit integers. Different files make use of those 8-bit 
integers in different ways. Only you know what meaning to give to the 
8-bit integers in the file that you're reading.

>Is there a way to read or decode into a standard array of elements (docs on read and encode are kind of skimpy)?
>  
>
If you have text data then you can skip the array and pass the encoding 
as an option:
let promise = OS.File.read(testFile, {encoding: "utf-8"});
The typed array is the best choice for binary data; was there some 
specific problem you were having with it?

-- 
Warning: May contain traces of nuts.