On Apr 14, 2014, at 00:25, ZhiQiang Tan wrote:
> my source code :
>
> var fs = require('fs');
> //var dpath = process.cwd();
> fs.readdir(process.cwd(),function(err,files){
> //console.log(files);
> console.log('');
> if(!files.length){
> return console.log("No files to show !\n");
> }
> console.log("Select which file or directory you want to see\n");
> function files(i){
> var filename = files[i];
> fs.stat(__dirname + '/' + filename, function(err,stat){
Apparently, at this point, stat is undefined. Check what err says.
> if(stat.isDirectory()){
> console.log(' '+i+' \033[36m' + filename +
> '/\033[39m');
> }else{
> console.log(' '+i+' \033[90m'+filename+'\033[39m');
> }
> i++;
> if(i==files.length){
> console.log('');
> process.stdout.write(' \033[33m Enter your choice: \033[39m');
> process.stdin.resume();
> }else{
> files(i);
> }
> });
> }
> files(0);
> });
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.