![]() ![]() At a minimum, they expect a 'choose file' button and standard file-chooser. Users expect to select files in the same way they always do. To use Chrome's File System API, you need to add the "fileSystem" permission to the manifest, so that you can obtain permission from the user to store persistent data. # Using the Chrome Filesystem API # Adding file system permission An attempt to create a directory in Sync Filesystem will result in INVALID_MODIFICATION_ERROR. Note: Unlike regular Filesystem API, Chrome's Sync Filesystem API currently does NOT support directory operations, except for reading directory entries in the root directory. When the user opens the text editor in a new client, Google Drive pushes new text files to that instance of the text editor. ![]() ![]() For example, a cloud-backed text editor app can automatically sync new text files to a user's Google Drive account. With Chrome's Sync Filesystem API, apps can save and synchronize data on a user's Google Drive so that the same data can be available across different clients. For example, a photo-sharing app can use the Filesystem API to read and write any photos that a user selects. With Chrome's Filesystem API, apps can create, read, navigate, and write to a sandboxed section of the user's local file system. For all other types of data, like binary data, use the Filesystem and Sync Filesystem APIs.Ĭhrome's Filesystem and Sync Filesystem APIs extend the HTML5 FileSystem API. ![]() With IndexedDB, you can persist JavaScript objects to an object store and use the store's indexes to query data (to learn more, see HTML5 Rock's Simple Todo List Tutorial). When saving data locally, you can use the Chrome Storage API to save small amounts of string data and IndexedDB to save structured data. You can also isolate external pages, so that the rest of your app is secure (see Embed external web pages). Similar to Chrome Extensions, you can use cross-origin XMLHttpRequests to communicate with remote servers. For external data (resources, web pages), you need to be aware of the Content Security Policy (CSP). Packaged apps use many different mechanisms to send and receive data. API Samples: Want to play with the code? Check out the filesystem-access, syncfs-editor and storage samples. ![]()
0 Comments
Leave a Reply. |