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