We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 264c935 commit e0dce5dCopy full SHA for e0dce5d
test/parallel/test-fs-read-stream-fd.js
@@ -3,21 +3,20 @@ const common = require('../common');
3
const fs = require('fs');
4
const assert = require('assert');
5
const path = require('path');
6
-var file = path.join(common.tmpDir, '/read_stream_fd_test.txt');
7
-var input = 'hello world';
8
-var output = '';
9
-var fd, stream;
+const file = path.join(common.tmpDir, '/read_stream_fd_test.txt');
+const input = 'hello world';
10
+let output = '';
11
common.refreshTmpDir();
12
fs.writeFileSync(file, input);
13
-fd = fs.openSync(file, 'r');
14
15
-stream = fs.createReadStream(null, { fd: fd, encoding: 'utf8' });
16
-stream.on('data', function(data) {
+const fd = fs.openSync(file, 'r');
+const stream = fs.createReadStream(null, { fd: fd, encoding: 'utf8' });
+
+stream.on('data', (data) => {
17
output += data;
18
});
19
20
-process.on('exit', function() {
21
- fs.unlinkSync(file);
22
- assert.equal(output, input);
+process.on('exit', () => {
+ assert.strictEqual(output, input);
23
0 commit comments