You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
953 B

'use strict';
const common = require('../common');
const assert = require('assert');
const path = require('path');
const fs = require('fs');
const emptyFile = path.join(common.fixturesDir, 'empty.txt');
fs.open(emptyFile, 'r', common.mustCall((error, fd) => {
assert.ifError(error);
const read = fs.createReadStream(emptyFile, { fd });
read.once('data', () => {
common.fail('data event should not emit');
});
read.once('end', common.mustCall(function endEvent1() {}));
}));
fs.open(emptyFile, 'r', common.mustCall((error, fd) => {
assert.ifError(error);
const read = fs.createReadStream(emptyFile, { fd });
read.pause();
read.once('data', () => {
common.fail('data event should not emit');
});
read.once('end', function endEvent2() {
common.fail('end event should not emit');
});
setTimeout(common.mustCall(() => {
assert.strictEqual(read.isPaused(), true);
}), common.platformTimeout(50));
}));