Classes
File
File
Represents a File entity on the file system.
Summary
Constructors
Properties
Constructors
constructor
new File(): File
inherited from constructor
Returns File
Properties
extension
Gets the extension of the file.
isLocked
Gets a value indicating whether the file is currently locked, meaning a background operation associated with this file is running.
size
Gets the size in bytes of the file.
android
StaticReadonly
ios
StaticReadonly
Methods
append
Appends the provided binary content to the file.
Parameter | Default | Description |
content |
| any The binary content to be saved to the file. |
Returns Promise<void>
appendSync
Appends the provided binary content to the file synchronously.
Parameter | Default | Description |
content |
| any The binary content to be saved to the file. |
onError |
| (error: any) => any An optional function to be called if some IO-error occurs. |
Returns void
appendText
Appends the provided string to the file, using the specified encoding (defaults to UTF-8).
Parameter | Default | Description |
content |
| string The content to be saved to the file. |
encoding |
| string An optional value specifying the preferred encoding (defaults to UTF-8). |
Returns Promise<any>
appendTextSync
Appends the provided string to the file synchronously, using the specified encoding (defaults to UTF-8).
Parameter | Default | Description |
content |
| string The content to be saved to the file. |
onError |
| (error: any) => any An optional function to be called if some IO-error occurs. |
encoding |
| string An optional value specifying the preferred encoding (defaults to UTF-8). |
Returns void
copy
Copies a file to a given path.
Parameter | Default | Description |
dest |
| string The path to the destination file.
Returns a Promise with a boolean. |
Returns Promise<boolean>
copySync
Copies a file to a given path.
Parameter | Default | Description |
dest |
| string The path to the destination file. |
onError |
| (error: any) => any (optional) A callback function to use if any error occurs.
Returns a Promise with a boolean. |
Returns any
read
Reads the binary content of the file asynchronously.
Returns Promise<any>
readSync
Reads the binary content of the file synchronously.
Parameter | Default | Description |
onError |
| (error: any) => any An optional function to be called if some IO-error occurs. |
Returns any
readText
Reads the content of the file as a string using the specified encoding (defaults to UTF-8).
Parameter | Default | Description |
encoding |
| string An optional value specifying the preferred encoding (defaults to UTF-8). |
Returns Promise<string>
readTextSync
Reads the content of the file as a string synchronously, using the specified encoding (defaults to UTF-8).
Parameter | Default | Description |
onError |
| (error: any) => any An optional function to be called if some IO-error occurs. |
encoding |
| string An optional value specifying the preferred encoding (defaults to UTF-8). |
Returns string
write
Writes the provided binary content to the file.
Parameter | Default | Description |
content |
| any The binary content to be saved to the file. |
Returns Promise<void>
writeSync
Writes the provided binary content to the file synchronously.
Parameter | Default | Description |
content |
| any The binary content to be saved to the file. |
onError |
| (error: any) => any An optional function to be called if some IO-error occurs. |
Returns void
writeText
Writes the provided string to the file, using the specified encoding (defaults to UTF-8).
Parameter | Default | Description |
content |
| string The content to be saved to the file. |
encoding |
| string An optional value specifying the preferred encoding (defaults to UTF-8). |
Returns Promise<any>
writeTextSync
Writes the provided string to the file synchronously, using the specified encoding (defaults to UTF-8).
Parameter | Default | Description |
content |
| string The content to be saved to the file. |
onError |
| (error: any) => any An optional function to be called if some IO-error occurs. |
encoding |
| string An optional value specifying the preferred encoding (defaults to UTF-8). |
Returns void
exists
Static
Checks whether a File with the specified path already exists.
Parameter | Default | Description |
path |
| string The path to check for. |
Returns boolean
fromPath
Static
- Previous
- FadeTransition
- Next
- FileSystemEntity