PSA: Cursor support for FileSystemSyncAccessHandles

28 views
Skip to first unread message

Austin Sullivan

unread,
Jan 31, 2023, 1:11:33 PM1/31/23
to blink-dev, Daseul Lee

Contact emails

asu...@chromium.org, ds...@chromium.org


Specification

https://github.com/whatwg/fs/pull/76 

https://github.com/whatwg/fs/pull/82 


Summary

We’re adding a cursor to FileSystemSyncAccessHandle, matching the behavior of the FileSystemWritableFileStream API (the other way to write files using the File System Access API).


Until now, failing to specify the optional at: parameter while reading or writing would set the offset of the operation to 0. In practice, this effectively required the parameter to be specified for every operation (and it was actually required until recently). Given this, we expect a low likelihood of site breakage.


Starting in M111, read and write operations will instead default to the position of an internal cursor that is updated with every read, write, and truncate operation. 


Before:

position += handle.write(data1, {at: position});

position += handle.write(data2, {at: position});


After:

handle.write(data1);

handle.write(data2);


Blink component

Blink>Storage>FileSystem


Tracking bug

crbug.com/1394790 


Estimated milestone

M111


Reply all
Reply to author
Forward
0 new messages