Lines Matching defs:write
8 const write = new Writable({
9 write(chunk, enc, cb) { cb(); }
12 write.on('finish', common.mustNotCall());
13 write.on('close', common.mustCall());
15 write.destroy();
16 assert.strictEqual(write.destroyed, true);
20 const write = new Writable({
21 write(chunk, enc, cb) {
27 write.on('error', common.mustCall());
28 write.on('finish', common.mustNotCall());
29 write.end('asd');
30 assert.strictEqual(write.destroyed, true);
34 const write = new Writable({
35 write(chunk, enc, cb) { cb(); }
40 write.on('finish', common.mustNotCall());
41 write.on('close', common.mustCall());
42 write.on('error', common.mustCall((err) => {
46 write.destroy(expected);
47 assert.strictEqual(write.destroyed, true);
51 const write = new Writable({
52 write(chunk, enc, cb) { cb(); }
55 write._destroy = function(err, cb) {
62 write.on('finish', common.mustNotCall('no finish event'));
63 write.on('close', common.mustCall());
64 write.on('error', common.mustCall((err) => {
68 write.destroy(expected);
69 assert.strictEqual(write.destroyed, true);
73 const write = new Writable({
74 write(chunk, enc, cb) { cb(); },
83 write.on('finish', common.mustNotCall('no finish event'));
84 write.on('close', common.mustCall());
87 write.on('error', common.mustNotCall('no error event'));
89 write.destroy(expected);
90 assert.strictEqual(write.destroyed, true);
94 const write = new Writable({
95 write(chunk, enc, cb) { cb(); }
98 write._destroy = common.mustCall(function(err, cb) {
103 write.destroy();
104 assert.strictEqual(write.destroyed, true);
108 const write = new Writable({
109 write(chunk, enc, cb) { cb(); }
112 write._destroy = common.mustCall(function(err, cb) {
122 write.on('finish', fail);
123 write.on('close', common.mustCall());
125 write.destroy();
127 assert.strictEqual(write.destroyed, true);
131 const write = new Writable({
132 write(chunk, enc, cb) { cb(); }
137 write._destroy = common.mustCall(function(err, cb) {
142 write.on('close', common.mustCall());
143 write.on('finish', common.mustNotCall('no finish event'));
144 write.on('error', common.mustCall((err) => {
148 write.destroy();
149 assert.strictEqual(write.destroyed, true);
154 const write = new Writable({
155 write(chunk, enc, cb) { cb(); }
159 write.on('close', common.mustCall(() => {
162 write.on('error', common.mustCall((err) => {
165 assert.strictEqual(write._writableState.errorEmitted, true);
169 write.destroy(expected);
170 write.destroy(new Error('kaboom 2'));
171 assert.strictEqual(write._writableState.errored, expected);
172 assert.strictEqual(write._writableState.errorEmitted, false);
173 assert.strictEqual(write.destroyed, true);
182 write(chunk, enc, cb) {
215 const write = new Writable({
216 write(chunk, enc, cb) { cb(); }
219 write.destroyed = true;
220 assert.strictEqual(write.destroyed, true);
223 write.on('close', common.mustNotCall());
224 write.destroy();
242 const write = new Writable({
243 write(chunk, enc, cb) { cb(); }
246 write.destroy();
250 write.destroy(expected, common.mustCall((err) => {
258 const write = new Writable({
259 write: common.mustNotCall(),
264 write.end();
265 write.once('close', common.mustCall(() => {
266 write._undestroy();
267 write.end();
272 const write = new Writable();
274 write.destroy();
275 write.on('error', common.mustNotCall());
276 write.write('asd', common.expectsError({
279 message: 'Cannot call write after a stream was destroyed'
284 const write = new Writable({
285 write(chunk, enc, cb) { cb(); }
288 write.on('error', common.mustNotCall());
290 write.cork();
291 write.write('asd', common.mustCall());
292 write.uncork();
294 write.cork();
295 write.write('asd', common.expectsError({
298 message: 'Cannot call write after a stream was destroyed'
300 write.destroy();
301 write.write('asd', common.expectsError({
304 message: 'Cannot call write after a stream was destroyed'
306 write.uncork();
312 const write = new Writable({
313 write(chunk, enc, cb) { cb(new Error('asd')); }
315 write.on('error', common.mustCall(() => {
316 write.destroy();
318 write.end(common.mustCall((err) => {
324 write.write('asd');
330 const write = new Writable({
331 write(chunk, enc, cb) { cb(); }
333 write.on('finish', common.mustCall(() => {
334 write.destroy();
336 write.end(common.mustCall((err) => {
342 write.end();
349 const write = new Writable({
350 write(chunk, enc, cb) { process.nextTick(cb); }
353 write.once('error', common.mustCall((err) => {
356 write.end('asd', common.mustCall((err) => {
359 write.destroy(_err);
363 // Call buffered write callback with error
366 const write = new Writable({
367 write(chunk, enc, cb) {
372 write.cork();
373 write.write('asd', common.mustCall((err) => {
376 write.write('asd', common.mustCall((err) => {
379 write.on('error', common.mustCall((err) => {
382 write.uncork();
389 const write = new Writable({
390 write(chunk, enc, cb) {
396 write.write('asd', common.mustCall(() => {
399 write.write('asd', common.mustCall((err) => {
403 write.destroy();
407 const write = new Writable({
409 write(chunk, enc, cb) {
415 write.on('error', common.mustCall(() => {
416 assert(write._writableState.errored);
418 write.write('asd');
423 const write = addAbortSignal(ac.signal, new Writable({
424 write(chunk, enc, cb) { cb(); }
427 write.on('error', common.mustCall((e) => {
429 assert.strictEqual(write.destroyed, true);
431 write.write('asd');
437 const write = new Writable({
439 write(chunk, enc, cb) { cb(); }
442 write.on('error', common.mustCall((e) => {
444 assert.strictEqual(write.destroyed, true);
446 write.write('asd');
453 const write = new Writable({
455 write(chunk, enc, cb) { cb(); }
458 write.on('error', common.mustCall((e) => {
460 assert.strictEqual(write.destroyed, true);
466 const write = new Writable({
467 write(chunk, enc, cb) { cb(); }
470 write.end(common.mustCall());
471 write.destroy();
472 write.destroy();