Closed PeterRao closed 1 year ago
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
复现的 node 版本:14、16,确认 node >= 18 不会出现此问题。
use 2.33.1
use 3.17.1