Interface FileWriter

This interface expands on the FileSaver interface to allow for multiple write actions, rather than just saving a single Blob.

Hierarchy

Index

Properties

Methods

Properties

public error: Error

The last error that occurred on the FileSaver.

public length: number

The length of the file. If the user does not have read access to the file, this will be the highest byte offset at which the user has written.

public onabort: (event: ProgressEvent) => void

Handler for abort events.

public onerror: (event: ProgressEvent) => void

Handler for error events.

public onprogress: (event: ProgressEvent) => void

Handler for progress events.

public onwrite: (event: ProgressEvent) => void

Handler for write events.

public onwriteend: (event: ProgressEvent) => void

Handler for writeend events.

public onwritestart: (event: ProgressEvent) => void

Handler for writestart events.

public position: number

The byte offset at which the next write to the file will occur. This always less or equal than length. A newly-created FileWriter will have position set to 0.

public readyState: number

The FileSaver object can be in one of 3 states. The readyState attribute, on getting, must return the current state, which must be one of the following values: INIT WRITING DONE

Methods

public abort()

Terminate file operation

public addEventListener(type: string, listener: EventListener, useCapture?: boolean)

Parameters

  • type: string
  • listener: EventListener
  • useCapture?: boolean optional

public dispatchEvent(evt: Event): boolean

Parameters

  • evt: Event

Returns

boolean

public removeEventListener(type: string, listener: EventListener, useCapture?: boolean)

Parameters

  • type: string
  • listener: EventListener
  • useCapture?: boolean optional

public seek(offset: number)

The file position at which the next write will occur.

Parameters

  • offset: number

    If nonnegative, an absolute byte offset into the file. If negative, an offset back from the end of the file.

public truncate(size: number)

Changes the length of the file to that specified. If shortening the file, data beyond the new length will be discarded. If extending the file, the existing data will be zero-padded up to the new length.

Parameters

  • size: number

    The size to which the length of the file is to be adjusted, measured in bytes.

public write(data: Blob)

Write the supplied data to the file at position.

Parameters

  • data: Blob

    The blob to write.