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

Listing Files from app data directory not working

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 Answer
0 Votes
3 REPLIES 3

Untested:

Try putting

let dirIter;

after the const line.

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Thanks, will make a note to fix this example

Best Answer
0 Votes

Hi @JonFitbit , I was facing the same issue today following this guide https://dev.fitbit.com/build/guides/file-system/

Best Answer