| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent eba9add commit dba8d20
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,21 +3,20 @@ const common = require('../common'); | |||
| 3 | 3 | const fs = require('fs'); | |
| 4 | 4 | const assert = require('assert'); | |
| 5 | 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; | ||
| 6 | + const file = path.join(common.tmpDir, '/read_stream_fd_test.txt'); | ||
| 7 | + const input = 'hello world'; | ||
| 10 | 8 | ||
| 9 | + let output = ''; | ||
| 11 | 10 | common.refreshTmpDir(); | |
| 12 | 11 | fs.writeFileSync(file, input); | |
| 13 | - fd = fs.openSync(file, 'r'); | ||
| 14 | 12 | ||
| 15 | - stream = fs.createReadStream(null, { fd: fd, encoding: 'utf8' }); | ||
| 16 | - stream.on('data', function(data) { | ||
| 13 | + const fd = fs.openSync(file, 'r'); | ||
| 14 | + const stream = fs.createReadStream(null, { fd: fd, encoding: 'utf8' }); | ||
| 15 | + | ||
| 16 | + stream.on('data', (data) => { | ||
| 17 | 17 | output += data; | |
| 18 | 18 | }); | |
| 19 | 19 | ||
| 20 | - process.on('exit', function() { | ||
| 21 | - fs.unlinkSync(file); | ||
| 22 | - assert.equal(output, input); | ||
| 20 | + process.on('exit', () => { | ||
| 21 | + assert.strictEqual(output, input); | ||
| 23 | 22 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments