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

Re: New draft of FileWriter API posted

From: Eric Uhrhane <ericu@google.com>
Date: Mon, 8 Mar 2010 19:01:35 -0800
Message-ID: <44b058fe1003081901w1515c07blff5966df1ca98040@mail.gmail.com>
To: Darin Fisher <darin@chromium.org>
Cc: public-device-apis@w3.org
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.
Received on Tuesday, 9 March 2010 03:02:24 GMT

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