Writing/Reading to the same file when increasing pm2 replicas
The bounty expires in 5 days. Answers to this question are eligible for a +50 reputation bounty. Dren is looking for an answer from a reputable source. I have a bull queue implemented in Redis, which accepts data in this format { sessionID : ’43i43ko4′ events : [{…}] } This data are being sent as […]
Best way to optimize writing files in chunks
I have a bull queue in a server which accepts some chunk data. Previously these chunk data were saved in a MongoDB individually in documents.
These chunks had a id in common so i grouped them by id then pushed the events together.
Why declare the function as async when the other function inside the function block is itself an asynchronous function
const fs = require(‘fs’).promises const filePath = ‘./me.txt’; async function readFileAsync(){ try{ const data= await fs.readFile(filePath,’utf-8′) console.log(data) } catch(err){ console.log(err) } } readFileAsync() taking the above code as an example.We know fs.readFile() is an async function and returns a promise and await will return the resolved value of the promise.Then why do we need to […]