I am trying to create a file using the example program, it shows **Successful
file write**, but I tried to get the file from my mobile using "ES File
Explorer" application, but I can not able to find the **fileToAppend.txt**
created file, please can you tell me where that file is stored.
`window.resolveLocalFileSystemURL(cordova.file.dataDirectory, function
(dirEntry) {
console.log('file system open: ' + dirEntry.name);
var isAppend = true;
createFile(dirEntry, "fileToAppend.txt", isAppend);
}, function(a,b,c){ debugger; });
function createFile(dirEntry, fileName, isAppend) {
// Creates a new file or returns the file if it already exists.
dirEntry.getFile(fileName, {create: true, exclusive: false},
function(fileEntry) {
debugger;
writeFile(fileEntry, null, isAppend);
}, function(a,b,c){ debugger; });
}
function writeFile(fileEntry, dataObj) {
// Create a FileWriter object for our FileEntry (log.txt).
fileEntry.createWriter(function (fileWriter) {
debugger;
fileWriter.onwriteend = function() {
console.log("Successful file write...");
//readFile(fileEntry);
};
fileWriter.onerror = function (e) {
console.log("Failed file write: " + e.toString());
};
// If data object is not passed in,
// create a new Blob instead.
if (!dataObj) {
dataObj = new Blob(['some file data'], { type: 'text/plain' });
}
fileWriter.write(dataObj);
});
}`
[ Full content available at:
https://github.com/apache/cordova-plugin-file/issues/248 ]
This message was relayed via gitbox.apache.org for [email protected]