Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using version 3.x, if an error occurs in writeStream, no error will be thrown #459

Closed
PeterRao opened this issue Aug 17, 2023 · 1 comment · Fixed by #460
Closed
Assignees
Labels
bug Something isn't working

Comments

@PeterRao
Copy link

const fs = require('fs');
const { request } = require('urllib');
const writeStream = fs.createWriteStream(__dirname + '/not-exist/test.js').on('error', (e) => {
  console.log('folder not exist');
})

request('https://aaaaddd.oss-cn-zhangjiakou.aliyuncs.com/%E6%96%B0%E5%BB%BA%E6%96%87%E6%9C%AC%E6%96%87%E6%A1%A3.txt', {
  writeStream: writeStream
}).then(data => {
  console.log('success');
}).catch(e => {
  console.log('error', e.message);
})

use 2.33.1

folder not exist
error ENOENT: 

use 3.17.1

folder not exist
success
@fengmk2 fengmk2 self-assigned this Aug 17, 2023
@fengmk2 fengmk2 added the bug Something isn't working label Aug 17, 2023
@fengmk2
Copy link
Member

fengmk2 commented Aug 17, 2023

复现的 node 版本:14、16,确认 node >= 18 不会出现此问题。

fengmk2 added a commit that referenced this issue Aug 17, 2023
fengmk2 added a commit that referenced this issue Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants