In article <[EMAIL PROTECTED]>, Brendan Eich <[EMAIL PROTECTED]>
wrote:
> Simon Fraser wrote:
>
> > I need to read in a file in JS, perferably a line at a time, using an
> > nsIFile. How to do this?
> >
> > I can make an nsIFileInputStream and init it with an nsIFile, but
> > nsIInputStream.read is not scriptable!
>
> You need to use nsIScriptableInputStream, implemented by an
> nsScriptableInputStream adapter class you create using the
> "@mozilla.org/scriptableinputstream;1" contract-id.
Ah, I'll try that.
> Alas, I don't see any read-one-line method. Are you adapting
> nsIFileSpec code?
Yes, Kin's editor logging code which has to read in a (potentially
huge) JS log file, and execute it a line at a time.
We really need someone to own the XPCOM file/stream stuff, and
finish the removal of ns(I)FileSpec. It's a mess now.
Simon
--
Simon Fraser Entomologist
[EMAIL PROTECTED] http://people.netscape.com/sfraser/