I'm generating several csv files on the bangle.js. Once it's done, I would like to make a convenient tool to download all files at the same time. For that, I'm creating a html tool for the app loader.
I followed the existing examples and start with:
<html>
...
var csvData = "";
function getData() {
fileData = [];
Util.showModal("Loading...");
dataElement.innerHTML = "";
var promise = Promise.resolve();
Puck.eval('require("Storage").list(/data-............\.csv/)',files=>{
if (files.length==0) {
dataElement.innerHTML = "<p>No saved data</p>";
} else {
files.forEach(file => {
This works and finds all my files. Then, in the loop, I would like to find a way to download everything at once. A satisfying way would be to concatenate all strings in the variable csvData, and then save it into a unique csv file on my computer. But definitely the best solution would be to save all files individually by pushing one button.
But I couldn't make it work at all. I'm also very confused about how the code is executed. The code after the loop "forEach" always finish after the code bellow despite not using async.
Could you give me some direction on how to solve my issue?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi,
I'm generating several csv files on the bangle.js. Once it's done, I would like to make a convenient tool to download all files at the same time. For that, I'm creating a html tool for the app loader.
I followed the existing examples and start with:
This works and finds all my files. Then, in the loop, I would like to find a way to download everything at once. A satisfying way would be to concatenate all strings in the variable csvData, and then save it into a unique csv file on my computer. But definitely the best solution would be to save all files individually by pushing one button.
But I couldn't make it work at all. I'm also very confused about how the code is executed. The code after the loop "forEach" always finish after the code bellow despite not using async.
Could you give me some direction on how to solve my issue?
Thanks!