
Provides methods to monitor the asynchronous writing of blobs to disk with a usage of progress events and event handler attributes.
An instance of this object is obtained by calling the createWriter, which returns a FileWriter associated with a file that is being written to.
The attributes of the FileWriter object are listed below:
| Constant | Description | Type |
|---|---|---|
| DONE | The entire Blob has been written to the file, an error occurred during the write, or the write was aborted using abort. The FileWriter is no longer writing the blob. | unsigned short |
| INIT | The object has been constructed, but there is no pending write. | unsigned short |
| WRITING | The blob is being written. | unsigned short |
| Attribute | Description | Type |
|---|---|---|
| readyState | Returns the current state of the FileWriter object, which takes one of the following values: "INIT", "WRITING", "DONE". | unsigned short |
| error | The last error that occurred on the FileWriter object. | DOMError |
| position | The byte offset, at which the next write to the file occurs. This must be no greater
than length. A newly created FileWriter
object instance has the position attribute set to 0 (zero). |
int |
| length | The length of the file. If the user does not have read access to the file, this is the highest byte offset at which the user has written. | string |
| queueOperations | Specifies whether FileWriter should queue subsequent operations or not. | boolean |
| Attribute | Description | Type |
|---|---|---|
| onwritestart | Handler for writestart events. | Function |
| onprogress | Handler for progress events. | Function |
| onwrite | Handler for write events. | Function |
| onabort | Handler for abort events. | Function |
| onerror | Handler for error events. | Function |
| onwriteend | Handler for writeend events. | Function |
| Name | Description |
|---|---|
| seek | Sets the file position at which the next write will occur. |
| truncate | Changes the length of the file to that specified. If shortening the file, the data beyond the new length is discarded. If extending the file, the existing data is zero-padded up to the new length. |
| write | Writes the supplied data to the file, starting at the offset indicated by the value of the "position" attribute. |
| abort | Terminates the algorithm for the currently executed method. |