write(|buffer|, {{FileSystemReadW
The truncate(|newSize|) method steps are:
-1. If [=this=].[=[[state]]=] is "`closed`", [=throw=] an "{{InvalidStateError}}"
- {{DOMException}}.
-1. Let |fileContents| be a copy of [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=].
-1. 1. Let |oldSize| be the [=byte sequence/length=] of [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=].
+1. If [=this=]'s [=[[state]]=] is "`closed`",
+ [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
+1. Let |fileContents| be a copy of [=this=]'s
+ [=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=].
+1. Let |oldSize| be the [=byte sequence/length=] of [=this=]'s
+ [=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=].
1. If the underlying file system does not support setting a file's size to
|newSize|, [=throw=] a {{TypeError}}.
1. If |newSize| is larger than |oldSize|:
1. If |newSize| − |oldSize| exceeds the available [=storage quota=],
[=throw=] a "{{QuotaExceededError}}" {{DOMException}}.
- 1. Set [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s to a [=byte sequence=] formed by concatenating
- |fileContents| with a [=byte sequence=]
- containing |newSize| − |oldSize| 0x00 bytes.
- 1. If the operations modifying the [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=] in the previous steps
- failed, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
+ 1. Set [=this=]'s [=FileSystemSyncAccessHandle/[[file]]=]'s to a
+ [=byte sequence=] formed by concatenating |fileContents| with a
+ [=byte sequence=] containing |newSize| − |oldSize| 0x00 bytes.
+ 1. If the operations modifying the [=this=]'s
+ [=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]
+ in the previous steps failed,
+ [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
1. Otherwise, if |newSize| is smaller than |oldSize|:
- 1. Set [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s to a [=byte sequence=] containing the first |newSize| bytes
- in |fileContents|.
- 1. If the operations modifying the [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=] in the previous steps
- failed, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
+ 1. Set [=this=]'s [=FileSystemSyncAccessHandle/[[file]]=]'s to a
+ [=byte sequence=] containing the first |newSize| bytes in |fileContents|.
+ 1. If the operations modifying the [=this=]'s
+ [=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]
+ in the previous steps failed,
+ [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
1. If [=this=]'s [=FileSystemSyncAccessHandle/file position cursor=] is greater than |newSize|, then set [=FileSystemSyncAccessHandle/file position cursor=] to |newSize|.
@@ -1572,9 +1588,10 @@ The truncate(|newSize|) method
The getSize() method steps are:
-1. If [=this=].[=[[state]]=] is "`closed`", [=throw=] an "{{InvalidStateError}}"
- {{DOMException}}.
-1. Return [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]'s [=byte sequence/length=].
+1. If [=this=]'s [=[[state]]=] is "`closed`",
+ [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
+1. Return [=this=]'s [=FileSystemSyncAccessHandle/[[file]]=]'s
+ [=file entry/binary data=]'s [=byte sequence/length=].
@@ -1588,8 +1605,8 @@ The getSize() method steps are:
The flush() method steps are:
-1. If [=this=].[=[[state]]=] is "`closed`", [=throw=] an "{{InvalidStateError}}"
- {{DOMException}}.
+1. If [=this=]'s [=[[state]]=] is "`closed`",
+ [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
1. Attempt to transfer all cached modifications of the file's content to the
file system's underlying storage device.