Elijo un archivo a través de DocumentPicker, obtengo el URI y lo paso a una función que debería abrir mi Documento (csv). Pero me sale el error ENSCOCOAERRORDOMAIN260 .
También traté de ver si hay un archivo, no. Pero acabo de seleccionarlo a través de DocumentPicker (obtengo el nombre de archivo, el tamaño, etc. a través de él)
Esa sería la función:
async readCSVsaveTOJson(uri){ var RNFS = require('react-native-fs'); //console.log(RNFS.TemporaryDirectoryPath); realDoc = uri.replace('file:/', ''); console.log(realDoc); var kacke = ''; var counter = 0; for(var i in realDoc){ if(counter > 0){ kacke += realDoc[i]; } counter++; } console.log('exists?'); console.log(RNFS.exists(kacke)); RNFS.readDir(kacke') .then((result) => { // stat the first file console.log('result'); return Promise.all([RNFS.stat(result[0].path), result[0].path]); }) .then((statResult) => { if (statResult[1].isFile()) { // if we have a file, read it var content = RNFS.readFile(kacke); console.log('--------------------------'); console.log(content); return RNFS.readFile(statResult[1], 'utf8'); } return 'no file'; }) .then((contents) => { // log the file contents console.log(contents); }) .catch((err) => { console.log('ERROR, theres is nothing'); console.log(err.message, err.code); }); } lanza console.log('ERROR, theres is nothing'); .. pero sé que debe haber algo.
¿Alguna recomendación?
Muchas gracias