Created
June 29, 2018 07:16
-
-
Save baptistemanson/bd8b5e1fccc44b0dccb51ffeca249710 to your computer and use it in GitHub Desktop.
Node can use several threads, even if you only write JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs"); | |
const util = require("util"); | |
const readFile = util.promisify(fs.readFile); | |
async function long() { | |
const content = await readFile("./dummy1000000.csv", "utf-8"); | |
content.split(/\n/); | |
} | |
const arr = []; | |
for (let i = 0; i < 10; i++) { | |
arr.push(long()); | |
} | |
Promise.all(arr).then(() => console.log("wicked parallel dang")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment