Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

1234567891011121314151617181920212223242526272829
  1. var through = require('through');
  2. var nextTick = typeof setImmediate !== 'undefined'
  3. ? setImmediate
  4. : process.nextTick
  5. ;
  6. module.exports = function (write, end) {
  7. var tr = through(write, end);
  8. tr.pause();
  9. var resume = tr.resume;
  10. var pause = tr.pause;
  11. var paused = false;
  12. tr.pause = function () {
  13. paused = true;
  14. return pause.apply(this, arguments);
  15. };
  16. tr.resume = function () {
  17. paused = false;
  18. return resume.apply(this, arguments);
  19. };
  20. nextTick(function () {
  21. if (!paused) tr.resume();
  22. });
  23. return tr;
  24. };