When performing this sequence
- Obtain a handle to a new file via
window.showSaveFilePicker, sayfilename.ext - Obtain a writeable file stream from the handle
- Write some content into the file using the stream
closethe stream to signal completion
the File System API writes to filename.ext.crswap and on close copies filename.ext.crswap to filename.ext
Is there a reason that filename.ext.crswap is not rather renamed to filename.ext?
The reason for this behavior is to avoid partial writes:
"User agents try to ensure that no partial writes happen, i.e. the file represented by
fileHandlewill either contain its old contents or it will contain whatever data was written through stream up until the stream has been closed."—Spec.