Answers for "javascript read folder name"

3

read directory in node js

const testFolder = './tests/';
const fs = require('fs');

fs.readdir(testFolder, (err, files) => {
  files.forEach(file => {
    console.log(file);
  });
});
Posted by: Guest on April-09-2021
0

How to scan a folder for documents with javascript

var dir = "/videos";
var fileextension = ".mp4";
$.ajax({
    //This will retrieve the contents of the folder if the folder is configured as 'browsable'
    url: dir,
    success: function (data) {
        // List all mp4 file names in the page
        $(data).find("a:contains(" + fileextension + ")").each(function () {
            var filename = this.href.replace(window.location.host, "").replace("http:///", "");
            $("body").append($("<img src=" + dir + filename + "></img>"));
        });
    }
});
Posted by: Guest on April-11-2020

Code answers related to "javascript read folder name"

Code answers related to "Javascript"

Browse Popular Code Answers by Language