Created
February 10, 2024 19:31
-
-
Save oneshadab/f224b281b6b8fecedb5b484bd4c5335a to your computer and use it in GitHub Desktop.
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
// > file-sync-blocking.test.mjs | |
import test from 'node:test'; | |
import assert from 'node:assert'; | |
import fs from "node:fs"; | |
test('reading file 10,000 times with callback blocking', (t) => { | |
for (let i = 0; i < 10000; i++ ) { | |
const data = fs.readFileSync("./text.txt", { encoding: 'utf-8'}) | |
assert.strictEqual(data, "Hello, world") | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment