HTML and CSS Reference
In-Depth Information
FileEntry state
options object
getFile response
No FileEntry found at given file path name
create: false exclusive ignored
Error is thrown
FileEntry created exclusive ignored
and returned [ b ]
create: true exclusive ignored
b You cannot create a FileEntry if its immediate parent directory doesn't exist.
We know that at this point you may be thinking, “When am I going to be able to test this
code?” Just a few more sections, we promise.
Step 4: View, edit, and delete files in the filesystem
The code to view, edit, and delete files in the filesystem is quite straightforward. The three
functions in listing 3.13 use two File System API methods: toURL and remove .
• The toURL method retrieves a URL location at which the file resource can be ac-
cessed. Using toURL is really convenient for viewing files. It saves you from hav-
ing to read the contents of the file and display it using JavaScript. Instead, you can
invoke a popup window and pass the URL location to it.
• The remove method deletes the file and executes a callback when it's done.
To implement the view, edit, and delete functionality, add the code from the next listing to
app.js right after the loadFile function.
 
Search WWH ::




Custom Search