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.
Best Answer04-25-2021 21:09
Gold Fitbit Product Experts share support knowledge on the forums and advocate for the betterment of Fitbit products and services. Learn more
04-25-2021 21:09
Untested:
Try putting
let dirIter;after the const line.
Best Answer04-30-2021 06:31
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
04-30-2021 06:31
Thanks, will make a note to fix this example
Best Answer04-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/