Re: Learning OS.File

Neil <[email protected]> Tue, 16 Dec 2014 18:07:58 +0000
Newsgroups gmane.comp.mozilla.devel.xpfe
Message-ID <[email protected]>
[email protected] wrote:

>Components.utils.import("resource://gre/modules/osfile.jsm");<BR>
>let deskDir = OS.Constants.Path.tmpDir;<BR>
>let testFile =  OS.Path.join(deskDir,"testFiles","csvTest.txt");<BR>
>let csvContents = OS.File.read(testFile);
>
>From the info on here and on the "OS.File for the main thread" page, this should read my text file into csvContents as array.
>  
>
I'm reading the same page and it says that it returns a Promise. If 
however you wrap your function in a Task you can make it look like a 
normal assignment:

let csvContents = yield OS.File.read(testFile);

-- 
Warning: May contain traces of nuts.