mirror of
https://github.com/nodejs/node.git
synced 2025-05-01 08:42:45 +00:00

The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
48 lines
1.0 KiB
JavaScript
48 lines
1.0 KiB
JavaScript
var common = require('../common');
|
|
var assert = require('assert');
|
|
var path = require('path');
|
|
var fs = require('fs');
|
|
|
|
var emptyFile = path.join(common.fixturesDir, 'empty.txt');
|
|
|
|
fs.open(emptyFile, 'r', function (error, fd) {
|
|
assert.ifError(error);
|
|
|
|
var read = fs.createReadStream(emptyFile, { 'fd': fd });
|
|
|
|
read.once('data', function () {
|
|
throw new Error('data event should not emit');
|
|
});
|
|
|
|
var readEmit = false;
|
|
read.once('end', function () {
|
|
readEmit = true;
|
|
console.error('end event 1');
|
|
});
|
|
|
|
setTimeout(function () {
|
|
assert.equal(readEmit, true);
|
|
}, 50);
|
|
});
|
|
|
|
fs.open(emptyFile, 'r', function (error, fd) {
|
|
assert.ifError(error);
|
|
|
|
var read = fs.createReadStream(emptyFile, { 'fd': fd });
|
|
read.pause();
|
|
|
|
read.once('data', function () {
|
|
throw new Error('data event should not emit');
|
|
});
|
|
|
|
var readEmit = false;
|
|
read.once('end', function () {
|
|
readEmit = true;
|
|
console.error('end event 2');
|
|
});
|
|
|
|
setTimeout(function () {
|
|
assert.equal(readEmit, false);
|
|
}, 50);
|
|
});
|