I'm trying to save a file by using fileSystem api.
It seems that this code below works fine.
But, I can't find where the saved file is located.
It should be located in the following directory if it's in mac os??
/Users/USERNAME/Library/Application Support/Google/Chrome/Default/File System/
I'm almost done with my project. All I have to do is implementing the function to save files in local drive!
please help me out!!
Thanks!
function writeToLocal(filename, content) {
function errorCallback(e) {
alert("Error: " + e.name);
}
function fsCallback(fs) {
fs.root.getFile(filename, {create: true}, function(fileEntry) {
fileEntry.createWriter(function(fileWriter) {
fileWriter.onwriteend = function(e) {
alert("Success! : " + fileEntry.fullPath);
};
fileWriter.onerror = function(e) {
alert("Failed: " + e);
};
var output = new Blob([content], {type: "text/plain"});
fileWriter.write(output);
}, errorCallback);
}, errorCallback);
}
webkitStorageInfo.requestQuota(PERSISTENT, 1024,
webkitRequestFileSystem(PERSISTENT, 1024, fsCallback, errorCallback),
errorCallback);
}
writeToLocal("test.txt", "hello world\n");
It's a virtual file system. It might not actually represented by your files being somewhere in a folder, though of course the filesystem container is somewhere on the drive. See this question.
As to how to get the data out of this filesystem, you can use chrome.downloads
API to export the file.
Your question is ambiguously tagged; if it's a Chrome App, you could use chrome.fileSystem
to work with real files instead.