I'm trying to call the number of files in a folder into a variable so that I can set the array size into that number.
Is this possible using JS and HTML?
I've found a piece of code that might be useful. However I don't understand it well, is it useful to the function I visioned? How?
const fs = require('fs');
var dir = '../imgvids';
fs.readdir(dir, (err, files) => {
console.log(files.length);
});
The intended porpuse is to create a variable and set the array size to it, so that then i can create a function that concatenates 'video' + 'i++' (i=0) and to stop at the size of the array so i can make a playlist of videos that autoplay muted.