HTML and CSS Reference
In-Depth Information
Listing 3.13. app.js—Viewing, editing, and deleting files
If you've been trying to test this functionality as you made your way through the section,
you may have found it difficult given that there are no files to load, view, edit, or delete!
Next, you'll learn how to create new empty files and how to allow users to import existing
files from their computer using a traditional file <input> element.
3.3.4. Creating new files
There are two ways of creating new files in the File System API. The first is to create a
new, empty file. The second is to allow the user to import an existing file from their com-
puter using a file <input> element. You'll now implement both of these options, starting
with creating empty files.
Step 5: Create new, empty files in the filesystem
In listing 3.12 you saw how the getFile method returns a FileEntry object for a given
filename if it exists:
var loadFile = function ( name ) {
fileSystem . root . getFile ( name , {}, function ( fileEntry ) {...
Search WWH ::

Custom Search