04-25-2021 19:55 - edited 04-25-2021 19:56
04-25-2021 19:55 - edited 04-25-2021 19:56
So, in the File System Guide it says to do this to list all files in /private/data directory:
import { listDirSync } from "fs"; const listDir = listDirSync("/private/data"); while((dirIter = listDir.next()) && !dirIter.done) { console.log(dirIter.value); }
When I run this on Versa 3 watch connected to the Fitbit Studio it gives this error:
**
Unhandled exception: ReferenceError: dirIter is not defined
**
By the way I have tried this when I have multiple files in the /private/data directory and it still does not work.
What is the problem? I appreciate your help.
04-25-2021 21:09
04-25-2021 21:09
Untested:
Try putting
let dirIter;
after the const line.
04-30-2021 06:31
04-30-2021 06:31
Thanks, will make a note to fix this example
04-29-2022 03:31 - edited 04-29-2022 03:33
04-29-2022 03:31 - edited 04-29-2022 03:33
Hi @JonFitbit , I was facing the same issue today following this guide https://dev.fitbit.com/build/guides/file-system/