fs.writeFile in a promise, asynchronous-synchronous stuff
问题 I need some help with my code. I'm new at Node.js and have a lot of trouble with it. What I'm trying to do: 1) Fetch a .txt with Amazon products (ASINs) ; 2) Fetch all products using the amazon-product-api package; 3) Save each product in a .json file. My code is not working. I think I messed up with this asynchronous-synchronous stuff - help me! var amazon = require('amazon-product-api'); var fs = require('fs'); var client = amazon.createClient({ awsId: "XXX", awsSecret: "XXX", awsTag: "888"