- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hola cree un archivo de texto y lo grabe a traves de mi aplicacion en el directorio Dcim/Camera.
ahora quiero ller los archivos que se encuentran en ese directorio, por leer me refiero a listar el nombre de los archivos.
encontre una aplicacion que supuestamente hace eso pero el codigo no funciona , aqui esta
Read Contents of a File
Using FileEntry object we can read contents of a file. In the above code we saw how to get FileEntry object using DirectoryEntry object.
Here is the code to read content of the file we created
function onDeviceReady()
{
requestFileSystem(LocalFileSystem.PERSISTENT, 0, onSuccess,onError);
}
function onSuccess(fileSystem)
{
var directoryEntry = fileSystem.root;
directoryEntry.getFile("readme.txt", {create: true,exclusive: false}, function(fileEntry){
//lets read the content of the file.
fileEntry.file(function(file){
//FileReader object streams the content of the file from storage disk to app
var reader = new FileReader();
reader.onloadend = function (evt) {
//result property is string type if you read data as string. If you read data as array buffer then its assigned to a array buffer object.
console.log(evt.target.result);
};
//to read the content as binary use readAsArrayBuffer function.
reader.readAsText(file);
}, function(error){
console.log("Error occurred while readline file. Error code is: " + error.code);
});
}, function(error){
console.log("Error occurred while getting a pointer to file. Error code is: " + error.code);
});
}
function onError(evt)
{
console.log("Error occurred during request to file system pointer. Error code is: " + evt.code);
}
si aguien me puede ayuda de lo agradeceria, el plugins File esa agregado a mi app
saludos
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I recommend you look at the following pages for help:
- https://www.neontribe.co.uk/cordova-file-plugin-examples/
- https://www.raymondcamden.com/2014/07/15/Cordova-Sample-Reading-a-text-file/
- https://www.raymondcamden.com/2014/11/05/Cordova-Example-Writing-to-a-file/
- http://www.html5rocks.com/en/tutorials/file/filesystem/
Mr. Raymond Camden has been involved in the Cordova and PhoneGap projects for a very long time and is very accomplished in the art of creating Cordova apps. His blogs contain very useful information.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thankyou but the example on the web no work for me
I don't know why

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page