chrome.fileSystem
Description: |
Use the chrome.fileSystem API to create, read, navigate,
and write to a sandboxed section of the user's local file system. With this
API, Chrome Apps can read and write to a user-selected location. For
example, a text editor app can use the API to read and write local documents.
All failures are notified via chrome.runtime.lastError.
|
Availability: |
Stable since Chrome 23.
|
Permissions: |
"fileSystem"
{"fileSystem": ["write"]} {"fileSystem": ["write", "retainEntries", "directory"]} |
Learn More: |
Manage Data
Build Apps with AngularJS Chrome Apps Office Hours: TextDrive and AngularJS |
Summary
Methods | |
---|---|
getDisplayPath −
chrome.fileSystem.getDisplayPath(Entry entry, function callback)
| |
getWritableEntry −
chrome.fileSystem.getWritableEntry(Entry entry, function callback)
| |
isWritableEntry −
chrome.fileSystem.isWritableEntry(Entry entry, function callback)
| |
chooseEntry −
chrome.fileSystem.chooseEntry(object options, function callback)
| |
restoreEntry −
chrome.fileSystem.restoreEntry(string id, function callback)
| |
isRestorable −
chrome.fileSystem.isRestorable(string id, function callback)
| |
retainEntry −
string
chrome.fileSystem.retainEntry(Entry entry)
|
Methods
getDisplayPath
chrome.fileSystem.getDisplayPath(Entry entry, function callback)
Get the display path of an Entry object. The display path is based on the full path of the file or directory on the local file system, but may be made more readable for display purposes.
Parameters | |||||
---|---|---|---|---|---|
Entry | entry | ||||
function | callback |
The callback parameter should be a function that looks like this: function(string displayPath) {...};
|
getWritableEntry
chrome.fileSystem.getWritableEntry(Entry entry, function callback)
Get a writable Entry from another Entry. This call will fail with a runtime error if the application does not have the 'write' permission under 'fileSystem'. If entry is a DirectoryEntry, this call will fail if the application does not have the 'directory' permission under 'fileSystem'.
Parameters | |||||
---|---|---|---|---|---|
Entry | entry | ||||
function | callback |
The callback parameter should be a function that looks like this: function(Entry entry) {...};
|
isWritableEntry
chrome.fileSystem.isWritableEntry(Entry entry, function callback)
Gets whether this Entry is writable or not.
Parameters | |||||
---|---|---|---|---|---|
Entry | entry | ||||
function | callback |
The callback parameter should be a function that looks like this: function(boolean isWritable) {...};
|
chooseEntry
chrome.fileSystem.chooseEntry(object options, function callback)
Ask the user to choose a file or directory.
Parameters | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
object | (optional) options |
|
||||||||||||||||||||||||
function | callback |
The callback parameter should be a function that looks like this: function(Entry entry, array of FileEntry fileEntries) {...};
|
restoreEntry
chrome.fileSystem.restoreEntry(string id, function callback)
Returns the file entry with the given id if it can be restored. This call will fail with a runtime error otherwise. This method is new in Chrome 31.
Parameters | |||||
---|---|---|---|---|---|
string | id | ||||
function | callback |
The callback parameter should be a function that looks like this: function(Entry entry) {...};
|
isRestorable
chrome.fileSystem.isRestorable(string id, function callback)
Returns whether the app has permission to restore the entry with the given id. This method is new in Chrome 31.
Parameters | |||||
---|---|---|---|---|---|
string | id | ||||
function | callback |
The callback parameter should be a function that looks like this: function(boolean isRestorable) {...};
|
retainEntry
string
chrome.fileSystem.retainEntry(Entry entry)
Returns an id that can be passed to restoreEntry to regain access to a given file entry. Only the 500 most recently used entries are retained, where calls to retainEntry and restoreEntry count as use. If the app has the 'retainEntries' permission under 'fileSystem', entries are retained indefinitely. Otherwise, entries are retained only while the app is running and across restarts. This method is new in Chrome 31.
Parameters | ||
---|---|---|
Entry | entry |