Skip to content

Instantly share code, notes, and snippets.

@alivesay
Created February 12, 2016 19:12
Show Gist options
  • Save alivesay/f05591ab056562def17d to your computer and use it in GitHub Desktop.
Save alivesay/f05591ab056562def17d to your computer and use it in GitHub Desktop.
function do_something_with_dir_list(stdout) {
res.render('index', {
title: 'MyPage',
subtitle: 'Below is a directory listing',
results: stdout
});
}
function dir_list(dir_list_done) {
var sys = require('sys');
var exec = require('child_process').exec
exec('ls -la', function(error, stdout, stderr) {
return dir_list_done(stdout);
});
}
app.get('/', function(req, res){
dir_list(do_something_with_dir_list);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment