I. I´m trying to make a skeleton of a app to read and write files in Neutralino.js but...
Now i´m stopped by trying to read the content of a selected file to a variable. I think the file is corrected selected, but... when using the Neutralino.filesystem.readFile it reads the text file whitout respecting the end of line carriege.
The conteudo_edm contains all the file content but just as a string, hope to be like a array, but there is no line breaks...
Any ideia?
async function lerN() {
let entries = await Neutralino.os.showOpenDialog('Abrir um ficheiro', {
filters: [
{ name: 'ISPOL', extensions: ['edm', 'EDM'] },
{ name: 'All files', extensions: ['*'] }
]
});
ficheiro = entries + ''
ficheiro = ficheiro.replace(/\\/g, "/")
conteudo_edm = await Neutralino.filesystem.readFile(entries[0]); //Aqui está a juntar tudo numa string!!!
console.log(conteudo_edm)
document.getElementById("lbl_ficheiroaberto").textContent = "Ficheiro aberto : " + ficheiro;
console.log("entries__")
console.log(entries)
console.log("entries__")
filtra_ficheiro(entries[0])
//document.getElementById("lbl_apagar").textContent = "estou a ler: " + ficheiro
}