I need to list all the files in the javascript such as \"ls\"??
Please give more information of your environment.
Unprivileged JavaScript in a browser can neither list files nor execute programs for security reasons.
In node.js for example executing programs works like this:
var spawn = require('child_process').spawn,
var ls = spawn('ls', ['-l']);
ls.stdout.on('data', function (data) {
console.log(data);
});
And there is a direct way to list files using readdir()