Loading files using javascript (translating my python code to javascript)

Description of the problem:

My experiment requires presenting different images in different trials. All the images were already saved in a folder under resources. This is a piece of code I wrote in python to read all the files in the folder.

I am struggling to find a javascript code that can read all the files in a folder. I am wondering if anyone has the same issue.

Thank you.

from os import listdir


allImagePatches = [f for f in listdir(imagePatchDestination) if f.startswith('croppedImage_sceneNum_')]

# set an image by default
whichCroppedImageA=imagePatchDestination + allImagePatches[0]
whichCroppedImageB=imagePatchDestination + allImagePatches[0]    


Hi Stella,

I’m afraid that I don’t think this is currently possible online. I would make a list of the files use DOS or Python and then create an Excel file with the results to use online.

Best wishes


1 Like