How to access name of file within fs callback methods?
问题 How do I get access to the the arguments of fs.read,fs.stat... methods from within a callback? For instance if I want to process a file based on its size Following (coffeeScript) code snippet #assuming test1.txt exists filename = "./test1.txt" fs.stat filename, (err, stats) -> data = filename:filename,size:stats.size console.log data #further process filename based on size filename = "./test2.txt" prints { filename: './test2.txt', size: 5 } as filename is set to "./test2.txt". If I process