html5-filesystem

filePluginIsReady event is never fired in chrome when using cordova-plugin-file

我怕爱的太早我们不能终老 提交于 2019-12-10 18:37:10
问题 I am now developing a cordova app whitch platform is browser(Chrome). I failed when using the cordova-plugin-file to read a file. According to the document of cordova-plugin-file : Chrome quirks, It said that: Chrome filesystem is not immediately ready after device ready event. As a workaround you can subscribe to filePluginIsReady event....You can use window.isFilePluginReadyRaised function to check whether event was already raised. I wrote my code like this : document.addEventListener(

Using File System as source of videos for playing offline

こ雲淡風輕ζ 提交于 2019-12-10 13:45:41
问题 I am trying to add offline functionality to my HTML5 video player. I am attempting to write the files into the chrome file system as a blob and then read them from there. I believe that I am running into an issue where the files are not actually being written, just the file name. As my below code is currently constituted, it works, though still only if it is permanently connected to the internet. My goal is to have the files download to a persistent directory in the filesystem and then

HTML5 Filesystem API: downloading a sandboxed file?

混江龙づ霸主 提交于 2019-12-08 21:17:58
问题 I have some data in indexeddb files, and I'd like to allow my users to download that data to import into other applications. I can use Blobs to do this easily: var blob = new Blob(['herp!'], {type: 'application/octet-stream'}); var iframe = document.createElement("iframe"); iframe.id = "myiframe"; iframe.style.display = "none"; iframe.src = window.webkitURL.createObjectURL(blob); // needs a revokeObjectURL $('#dlplaceholder').append(iframe); The correct type parameter to Blob is key: if I set

How to detect directory select capability in browsers?

时光总嘲笑我的痴心妄想 提交于 2019-12-08 17:40:15
问题 I am trying to find out if browser has ability to select folders, not just multiple files. Current Chrome supports this (example: http://html5-demos.appspot.com/static/html5storage/demos/upload_directory/index.html). Apparently, it works in Chrome when <input type="file" /> has webkitdirectory attribute. But how can I test if browser is actually capable of selecting folders and iterating through files? 回答1: Maybe this is a solution for your problem: function isInputDirSupported() { var

Can the synchronous file system api be used in a chrome extension

廉价感情. 提交于 2019-12-08 11:09:15
问题 I'm creating page action popup in google extensions. I need to write contents back to a file when the popup gets closed. For this I have attached the window.unload event. In the unload handler I'm trying to write to the file. But since I'm using the asynchronous api, immediately after setting the successHandler for the getFile function, the page gets closed and the successHandler does not get executed. Can I use the synchronous file api here? I read that the synchronous apis can be used only

Getting FileError when trying to use the HTML5 file api in google chrome

ⅰ亾dé卋堺 提交于 2019-12-07 12:13:01
问题 I was trying to create a file using the file system API in chrome. Initially I tried PERSISTENT storage as follows window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; webkitStorageInfo.requestQuota(webkitStorageInfo.PERSISTENT, 1024*1024, function(grantedBytes) { window.requestFileSystem(webkitStorageInfo.PERSISTENT, grantedBytes, onInitFs, errorHandler); }, errorHandler); It was working fine initially. But now when I try the same code is giving me the

Replacement for fileEntry.toURL() in Chrome Packaged Apps

我是研究僧i 提交于 2019-12-07 12:07:03
问题 I'm using the HTML5 FileSystem API in a Chrome Packaged App to write to a log file. I want the user to be able to download this file, so I tried something along the lines of: fs.root.getFile('log.txt', {create: false}, function(fileEntry) { var url = fileEntry.toURL(); // do something with the file url }); This doesn't help though, because the URL is something like filesystem:chrome-extension://eekedjcagggbfigdmifkmhkjbhiklnpj/temporary/log.txt and it's not possible to open it somewhere. What

Replacement for fileEntry.toURL() in Chrome Packaged Apps

让人想犯罪 __ 提交于 2019-12-05 18:18:20
I'm using the HTML5 FileSystem API in a Chrome Packaged App to write to a log file. I want the user to be able to download this file, so I tried something along the lines of: fs.root.getFile('log.txt', {create: false}, function(fileEntry) { var url = fileEntry.toURL(); // do something with the file url }); This doesn't help though, because the URL is something like filesystem:chrome-extension://eekedjcagggbfigdmifkmhkjbhiklnpj/temporary/log.txt and it's not possible to open it somewhere. What technique would you recommend to make a FileSystem API file in a Packaged App downloadable? Edit:

Handle directory/files upload with one input javascript

ぃ、小莉子 提交于 2019-12-05 08:08:12
问题 I want to allow users dragging and uploading directory and files. i know i could create <input type="file" multiple /> <!-- for files/multiple files upload--> and <input type="file" directory mozDirectory webkitDirectory /> <!-- for directory uploads --> i tried detecting while user is dragging the item if it is a directory or file and setting directory attribute depending on that, but turns out that javascript doesn't allow you to check that. also i have seen on lot of websites that users

Chrome App SecurityError on file creation

你离开我真会死。 提交于 2019-12-05 05:14:10
I have the following code: chrome.runtime.getPackageDirectoryEntry(function(directoryEntry) { directoryEntry.getFile("files/test.txt", {create: true, exclusive: false}, function(fileEntry) { console.log(fileEntry); }, function(error) { console.log(error); }); }); If the file does not exist and create is true I get an It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources. error. But if it does exist and create is false I get access to the file. What am I doing wrong? 来源: https://stackoverflow.com/questions