A problem with fs.statSync

  node.js, question
"use strict";
 var fs = require('fs');
 var colors = require('colors/safe');
 fs.readdir(process.cwd(), function (err, files) {
 files.forEach(function (item, index, array) {
 fs.statSync(item, function (err, stat) {
 if (stat.isDirectory()) {
 Log (colors.blue (item plus'/'));
 bracket
 else if (stat.isFile()) {
 console.log(colors.green(item));
 bracket
 });
 });
 });

This program originally wanted to print out the files in the current directory, but if I change fs.stat to fs.statSync, I can’t output it. why? Node’s version is v0.12.7

Because statSync is a synchronization method, the result is directly obtained, that is, stat = fs.statSync(item) and then judge stat.isDirectory ()