I'm using Intel Edison as a server that collects data and then saves the data to a file in SD card. I'm using Node.js. I know that it is possible to save as TXT file.
But is it possible to save the data as CSV format file? Please show me how if it is possible.
Thanks and best regards.
Thanks for your interest in the Intel® Edison Platform.
I have not saved data as a CSV format file before, however, I have been investigating how it could be done and I'd suggest you to try to use nodeCSV, it provides CSV generation, parsing, transformation and serialization for Node.js. Please take a look at https://github.com/wdavidw/node-csv# readme NodeCSV for more details.
Hope you find this information useful.
Your welcome, we are here to help you. Regarding your question, you can write your own code to store the JSON file using the file system (fs) module and specifying the path of the SD card that is usually mounted in /media/sdcard. Please take a look at the "Write file" section here: http://en.proft.me/2016/03/20/how-read-and-write-file-nodejs/ How to read and write a file in Node.js.
Additionally, you can also take a look at these link for extra information:
- https://docs.nodejitsu.com/articles/file-system/how-to-write-files-in-nodejs/ https://docs.nodejitsu.com/articles/file-system/how-to-write-files-in-nodejs/
- https://nodejs.org/api/fs.html# fs_fs_write_fd_buffer_offset_length_position_callback https://nodejs.org/api/fs.html# fs_fs_write_fd_buffer_offset_length_position_callback
- http://stackoverflow.com/questions/36856232/write-add-data-in-json-file-using-node-js http://stackoverflow.com/questions/36856232/write-add-data-in-json-file-using-node-js
Hope this information helps.