DeviceStorage.getEditable()

This API is available on Firefox OS for privileged or certified applications only.

Summary

The getEditable method is used to retrieve a file, which is editable, from a given storage area.

If the request is successful, the request's result is a FileHandle object used to access and update the file on the device.

Syntax

JavaScript
var instanceOfDOMRequest = instanceOfDeviceStorage.getEditable(fileName);

Parameters

fileName
A string representing the full name (path + file name) of the file to retrieve.

Returns

It returns a DOMRequest object to handle the success or error of the operation.

Example

JavaScript
var sdcard = navigator.getDeviceStorage("sdcard");

var request = sdcard.getEditable("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);
}

Specification

Not part of any specification.

See also

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/devicestorage/geteditable

API B2G Device Storage Firefox OS Method Reference Référence WebAPI