Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. 'use strict';
  2. const fs = require('fs');
  3. let i = 0;
  4. const printer = function () {
  5. const fil = fs.createWriteStream('file');
  6. const MAX_LIM = 1e600;
  7. const writer = function () {
  8. let result = true;
  9. while (i < MAX_LIM && result) {
  10. result = fil.write(`->${i}<-\n`);
  11. i += 1;
  12. }
  13. if (i < MAX_LIM)
  14. fil.once('drain', writer);
  15. }
  16. return writer;
  17. }
  18. const printty = printer();
  19. printty();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement