W3C home > Mailing lists > Public > public-device-apis@w3.org > March 2010

Re: New draft of FileWriter API posted

From: Darin Fisher <darin@chromium.org>
Date: Tue, 9 Mar 2010 00:00:36 -0800
Message-ID: <bd8f24d21003090000k7e29e0d2r64a9dc8c911e47ab@mail.gmail.com>
To: Eric Uhrhane <ericu@google.com>
Cc: public-device-apis@w3.org
On Mon, Mar 8, 2010 at 7:01 PM, Eric Uhrhane <ericu@google.com> wrote:

> On Mon, Mar 8, 2010 at 11:16 AM, Darin Fisher <darin@chromium.org> wrote:
> > On Fri, Mar 5, 2010 at 6:01 PM, Eric Uhrhane <ericu@google.com> wrote:
> >>
> >> I've just posted a new draft of the File Writer API [1], based on the
> >> version I posted in January [2].  I look forward to your feedback.  In
> >> the mean time, I'll get going on a clean draft of the FileSystem API.
> >>
> >> Thanks,
> >>
> >>      Eric Uhrhane
> >>      ericu@google.com
> >>
> >> [1] http://dev.w3.org/2009/dap/file-system/file-writer.html
> >> [2]
> >>
> http://lists.w3.org/Archives/Public/public-device-apis/2010Jan/0228.html
> >>
> >
> > Thanks for posting this.  Some questions:
> > 1-  What is the proposed way to get a FileWriter from an <INPUT
> > type="saveas"> element?
>
> I was thinking of something like:
>
> var writer = document.forms['downloadData']['fileChooser'].fileWriter;
>
> If we make it parallel to the file reader API, that would be an array
> rather than a single FileWriter, but it's not clear to me that you'll
> ever actually want to browse for more than one save location in a
> single operation.
>
> > 2-  In the sample, it appears that onwrite is used to signal completion.
> >  But is that called if the write completes with an error as well?  Or, is
> > onwrite only called if successful?
>
> Write should be sent only on successful completion.  Writeend should
> be sent on any completion [success or failure].  I'll add that to the
> write method description and the event descriptions.
>
> > 3-  How are the onwritestart, onwriteend, and onprogress events defined?
> > 4-  It would be good to document when the "length" and "position"
> properties
> > are updated.
>
> I'll flesh that out, but basically you get a writestart at some time
> between argument validation and the first progress event, you then get
> progress events periodically throughout the write, each of which
> corresponds to a chunk of bytes being written to the disk and length
> and position getting updated, and then you get a write and a writeend.
>
> > 5-  Can seek throw an exception if position > length?  Or, is it valid to
> > seek beyond the end of the file?
>
> If you attempt to seek beyond the end of the file, you just get a seek
> to the end.
>
> "If position is greater than length, length is used instead."
>
> > 6-  Can truncate fail?  I would assume so.
>
> Yes, truncate should really be asynchronous as well on FileWriter,
> since it's another kind of write.  I'll fix that.
>


Thanks for clarifying.  This all sounds good to me.
-Darin
Received on Tuesday, 9 March 2010 08:01:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:14:06 GMT