This API is available on Firefox OS for privileged or certified applications 仅。
get
method is used to retrieve a read-only file from a given storage area.
If the request is successful, the request's
result
是
File
object containing the data of the original file on the device.
var instanceOfDOMRequest = instanceOfDeviceStorage.get(fileName);
fileName
A string representing the full name (path + file name) of the file to retrieve.
It returns a
DOMRequest
object to handle the success or error of the operation.
var sdcard = navigator.getDeviceStorage("sdcard");
var request = sdcard.get("myFile.txt");
request.onsuccess = function () {
var name = this.result.name;
console.log('File "' + name + '" successfully retrieved from the sdcard storage area');
}
request.onerror = function () {
console.warn('Unable to get the file: ' + this.error);
}
Not part of any specification.