Lines Matching refs:file
38 const file = fs.createReadStream(fn, options);
41 assert.strictEqual(file.bytesRead, 0);
43 file.on('open', common.mustCall(function(fd) {
44 file.length = 0;
46 assert.strictEqual(file.bytesRead, 0);
47 assert.ok(file.readable);
50 file.pause();
51 file.resume();
52 file.pause();
53 file.resume();
56 file.on('data', function(data) {
60 file.length += data.length;
63 assert.strictEqual(file.bytesRead, bytesRead);
66 file.pause();
70 file.resume();
75 file.on('end', common.mustCall(function(chunk) {
77 assert.strictEqual(file.bytesRead, fileSize);
81 file.on('close', common.mustCall(function() {
83 assert.strictEqual(file.bytesRead, fileSize);
87 assert.strictEqual(file.length, 30000);
101 const file = fs.createReadStream(fn, { encoding: 'utf8' }); constant
102 file.length = 0;
103 file.on('data', function(data) {
105 file.length += data.length;
113 file.on('close', common.mustCall());
116 assert.strictEqual(file.length, 10000);
121 const file = constant
124 file.on('data', function(data) {
127 file.on('end', common.mustCall(function(data) {
133 const file = fs.createReadStream(rangeFile, { bufferSize: 1, start: 1 }); constant
134 file.data = '';
135 file.on('data', function(data) {
136 file.data += data.toString('utf-8');
138 file.on('end', common.mustCall(function() {
139 assert.strictEqual(file.data, 'yz\n');
145 const file = fs.createReadStream(rangeFile, { bufferSize: 1.23, start: 1 }); constant
146 file.data = '';
147 file.on('data', function(data) {
148 file.data += data.toString('utf-8');
150 file.on('end', common.mustCall(function() {
151 assert.strictEqual(file.data, 'yz\n');
226 let file = fs.createReadStream(rangeFile, { autoClose: false }); variable
228 file.on('data', function(chunk) { data += chunk; });
229 file.on('end', common.mustCall(function() {
232 assert(!file.closed);
233 assert(!file.destroyed);
240 file = fs.createReadStream(null, { fd: file.fd, start: 0 });
241 file.data = '';
242 file.on('data', function(data) {
243 file.data += data;
245 file.on('end', common.mustCall(function(err) {
246 assert.strictEqual(file.data, 'xyz\n');
249 assert(file.closed);
250 assert(file.destroyed);
257 const file = fs.createReadStream(null, { fd: 13337, autoClose: false });
258 file.on('data', common.mustNotCall());
259 file.on('error', common.mustCall());
261 assert(!file.closed);
262 assert(!file.destroyed);
263 assert(file.fd);
269 const file = fs.createReadStream('/path/to/file/that/does/not/exist');
270 file.on('data', common.mustNotCall());
271 file.on('error', common.mustCall());
274 assert(!file.closed);
275 assert(file.destroyed);