syncblock

Turns async block into sync

Usage no npm install needed!

<script type="module">
  import syncblock from 'https://cdn.skypack.dev/syncblock';
</script>

README

syncblock

Turns Asynchronous block into synchronous one

Usage

Install

$ npm install --save syncblock

Example

var fs = require('fs');
var syncblock = require('syncblock');

syncblock.begin(function(ticket) {
  // request HTTP, read/write DB,...
  fs.readFile('/etc/passwd', function(err, data) {
    if (err) throw err;
    console.log(data);
    ticket.end();
  });
});