FileSystem API behavior of seek function

I am writing to give my feedback on the behavior of the FileWriter seek
function.

From
http://www.w3.org/TR/file-writer-api/#widl-FileWriter-seek-void-long-long-offset,
we see that for FileWriter.seek, "If position > length then set position to
length." (where length is the length of the file)

It would be really nice if seeking past the end of the file would cause
zeros to be written in the byte range [length, position-1], just how POSIX
does it. I have an application that needs to write past the file boundary
and so emulates POSIX behavior in JavaScript user space land, but it is
quite slow and inefficient compared to having it be done by the underlying
system call.

Not matching the behavior of POSIX seek seems like a poor design decision
to me. Was the current behavior chosen for simplicity of implementation?

If the behavior of FileWriter seek were changed to match the POSIX
behavior, how would applications be able to predict which version of the
FileWriter seek implementation were being used?

Received on Saturday, 18 January 2014 22:17:12 UTC