Skip to content

Instantly share code, notes, and snippets.

@nootanghimire
Last active December 17, 2015 21:59
Show Gist options
  • Save nootanghimire/5678946 to your computer and use it in GitHub Desktop.
Save nootanghimire/5678946 to your computer and use it in GitHub Desktop.
Trying to ue devisestorage api
(function () {
var pickAnything = document.querySelector("#pick-anything");
if (pickAnything) {
pickAnything.onclick = function() {
var storage = navigator.getDeviceStorage("sdcard");
cursor = storage.enumerate();
cursor.onerror = function() {
console.error("Error in DeviceStorage.enumerate()", cursor.error.name); //console shows this error
};
cursor.onsuccess = function() {
if (!cursor.result)
alert('something');
}
alert(cursor.result);
var file = cursor.result;
// Show file
alert(file.name);
console.log(file.name);
};
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment