Replies: 1 comment
-
Ok, I did some digging, and finally find out the problem. Development environment: I create the readable stream using const waitForOpenFile = async (file: ReadStream): Promise<void> =>
new Promise((resolve, reject) => {
const onError = (error: Error): void => {
reject(error);
};
// Node.js 12 has incomplete types
if (!(file as any).pending) {
resolve();
}
file.once('error', onError);
// event never triggered
file.once('ready', () => {
file.off('error', onError);
resolve();
});
});
// the promise here never resolves
if (this.options.body instanceof ReadStream) {
await waitForOpenFile(this.options.body);
} Eventually, got cannot even make the request. I'am not sure this is the bug of fs-extra or got, hope you guys could figure it out. FYI @szmarczak @sindresorhus |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In got, I write the following but nothing happens. Not a response or an error, none of the hooks are executed.
I've searched issues and docs, cannot find a comprehensive guideline of how to upload files. Here is how I achieve the same thing in axios :
Could really need some help, thanks.
Beta Was this translation helpful? Give feedback.
All reactions