Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i want text append to text file in fitbit

I don't know why the text is still blank here

There is no special error, and what I want is to save the accelerometer and heart rate in a text file every 5 seconds append and then know the file size in the text collected during the day.

Can you give me some advice on how to do it?

 

let thisDate = new Date();
let recFilename = `RawDataLogger-${thisDate.getFullYear()}${("0" + (thisDate.getMonth() + 1)).slice(-2)}${("0" + (thisDate.getDate() + 1)).slice(-2)}.txt`;

var timer = setInterval(function(){
refreshData();

//정상값 출력
//console.log(accelData.text);
//console.log(hrmData.text);
},5000)

function refreshData() {
// Populate ArrayBuffer
buffer[0] = thisDate.getTime();
buffer[1] = accelData.text;
// Write ArrayBuffer to file
append("utf8.txt" , buffer);
}


function append(filename, buffer) {
let fd = fs.openSync(filename, 'w+');
fs.writeSync(fd, buffer);
fs.closeSync(fd);
console.log("is append" , buffer);
}

 

can you help? 

Best Answer
0 Votes
1 REPLY 1

I noticed you posted another thread, assuming you got past this one.

Best Answer
0 Votes