| Reference | Downloads | Github

Accessing Images Folder on Pavlovia

Hi all,
How can I access my images folder from my experiment.js file? Both are in the same repository on Pavlovia. I want to create a list of all the images in this file. I tried to use …

const fs = require(‘fs’);
const images = fs.readdirSync(’/images’)

But it is throwing an error from the ‘require’ line. Any other suggestions?


Sorry – I don’t think this works online:

There must be another way to just access the image files in this folder. They are in my Pavlovia repository, in the same directory as the experiment.js file. I feel like this must be a pretty common thing that people want to do. Perhaps the only way to make a list out of these images is to manually write it out? Such as,

myList = [‘images/im1’, ‘images/im2’, …]

Is there a simpler way?


1 Like