PhoneGap File System Actions - (File URI Based) Action Javascript

Description

The PhoneGap File System Actions - (File URI Based) Action Javascript allows you to perform an action on a mobile device's file system in a PhoneGap application. The directory in which the file system action is performed is specified using a file URI.

Discussion

PhoneGap File System Actions - (File URI Based) is similar to PhoneGap - File System Actions in that both actions allow you to perform actions on the device's file system, such as read a file, write a file, create a directory, delete a directory, etc. The key difference is PhoneGap File System Actions - (File URI Based) gives you explicit control over where the operations are performed in the device's file system by specifying a file URI. PhoneGap - File System Actions only operates on files in a default location.

You can perform the following actions using PhoneGap File System Actions - (File URI Based) Action Javascript:

Action Name
Description
File System Is Available

Returns true if PhoneGap is running an the local file system is available.

Get Base URI of Requested File System Part

Returns the file URI of the requested part of the file system. Your code can request the URI for the following abstract file system parts: 'temp', 'private', 'saved' or 'public'.

Read a File

Read the contents of a file. Optionally specify a starting and ending position in the file.

Write a File

Write a file. Optionally specify if the data should be appended to the end of the existing data if the file already exists.

Check if file exists

Check if a file exists. If the file does exist, the callback function is called with the properties of the file (such as size, date last updated, etc.).

Delete a file

Delete a file.

Copy a file

Copy a file.

Move a file

Move a file.

Remove a directory (recursively)

Deletes the specified directory and all of its contents, including other directories and their contents.

Create directories (recursively)

Ensures that a directory structure (specified by subdirpath) exists within the specified rootpath. If the directories do not exist, they are created.

List files in a directory (recursively)

List files in a directory and the sub-directories of the specified directory.

List matching files in a directory

List files in a directory. If a filter (defined by a regular expression) is specified only matching files are listed.

Delete matching files

Delete files. If a filter (defined by a regular expression) is specified, only matching files are deleted. If a 'keep list' is specified files in the list are not deleted, even if they matched.

See Also