Asynchronous Vs synchronous in NodeJS

后端 未结 4 544
自闭症患者
自闭症患者 2021-02-08 01:59

I\'m new to NodeJS. I have seen there are separate asynchronous and synchronous functions for the same task (ex: {fs.writeFile,fs.writeFileSync} , {fs.read, f

4条回答
  •  无人及你
    2021-02-08 02:11

    Async:

    1. Send request
    2. go on with other code
    3. response come in any time on a callback

    Sync:

    1. Send request
    2. Wait for response
    3. go on with other code after response

提交回复
热议问题