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.

另请参阅

元数据

  • 最后修改: