-
-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Add support for Stream #296
Conversation
@nickuraltsev Can you share any additional documentation on what is required to support upload streams on the server side? Also, if I stream data to the server does that mean the response has to be streamed back as well? Really great job on the PR btw, updated tests and documentation are great! |
I didn't understand how this is implemented from axios. This is an example but it's not working: var FormData = require('form-data'),
axios = require('axios'),
fs = require('fs'),
data = new FormData();
data.append('something', 'something');
data.append('file', fs.createReadStream('myFile.md');
axios.post('http://localhost:12345/api', data, {headers: data.getHeaders()}).then(...).catch(...); This doesn't send data to the server. Thanks in advance, |
@wilk The code looks good to me. Are you using the latest version of axios? |
Uhm, right: I'm using the 0.9.1 version. I think it doesn't support yet that feature, right? |
@wilk Right, it was implemented in 0.11.0 |
@nickuraltsev right, it's working with 0.11.0, thanks ;) |
I think this is broken again. I am getting Error: write after end |
How do I specify a file name for the stream upload on the server? Usually when you send a HTML file from the browser, it has a file name which is sent to the server. |
@jeffijoe i don't think this is an issue when you create form data you can send the filename as another form data value |
Right but I think for it to be as agnostic as possible you would need to specify it in some way for libraries like busboy to pick it up |
Works fine... tested with recent versions: const form = new FormData();
form.append('file', fs.createReadStream(path));
const result = await this.client.post(`some/path`, form, {
headers: form.getHeaders(),
}); |
Fixes #2