- Operating System: Linux 4.15.0-52 Debian
- Node.js version: 12.2.0
fs-extra version:8.1.0
When writing object asynchronously with outputJson, the object is not preserved, before the promise is returned.
Example:
const fs = require('fs-extra');
( async () => {
let i;
let obj = {}
let promises = [];
for( i = 0; i<4; i++ ){
obj.id = i;
promises.push( fs.outputJson('./' + i, obj) );
}
await Promise.all(promises);
for( i = 0; i<4; i++ )
console.log( await fs.readJson('./' + i));
})();