how to display 2 directory lists side by side in node.js express

scenario: clients can upload to 2 directories

wanted result: client can see the listings of both directories side by side

am newbie to these.

  1. a couple of jquery listbox widgets to display the directory listing
  2. can new entries be automatically shown or limited to clients hitting a "refresh" button?

is this feasible/possible?

are there packages in npm that does part of the above already?

thanks for any/all opinions/ideas.

It sounds like you can do everything you want to by just a little bit of HTML/CSS. In the simplest form just do something like this.

var fs = require('fs');

app.get('/foo', function(req, res){

    fs.readdir('dir1', function(error, result){

        res.write('<div class="bar">');
        res.write('<ul>');
        //write out all of the files as list
        res.write('</div>');
        fs.readdir('dir2', function(error, result){
            res.write('<div class="bar">');
            res.write('<ul>');
            //write out all of the files as lis
            res.write('</div>');
            res.end();
        });
    });
});

Then, on the client side, make a css rule

 .bar{
     float: left;
 }

That will pull them both to the left assuming that they are both in a relative wrapper div. You can gussy it up with jquery/css as much as you want from there. This will update the two of them every time that there's a request (i.e. on refresh). If you want it happen in real-time then look into Socket.io or some other websocket tool.