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

Response headers with createReadStream #142

Closed
Paxa opened this issue Jan 27, 2019 · 2 comments · Fixed by #246
Closed

Response headers with createReadStream #142

Paxa opened this issue Jan 27, 2019 · 2 comments · Fixed by #246

Comments

@Paxa
Copy link

Paxa commented Jan 27, 2019

Is it possible to get response headers when using createReadStream method?

As I see in createStream.js:

return request(requestOptions).then(responseHandlers.handleResponseCode).then(res => res.data);

.then(res => res.data) - this makes possible to access only body

@Paxa
Copy link
Author

Paxa commented Jan 27, 2019

Found workaround:

const axios = require("axios");

const url = client.getFileDownloadLink(davPath);
axios({
  method: 'get',
  url: url,
  responseType: 'stream'
}).then(response => {
  console.log('headers', response.headers);
  response.data.pipe(..);
});

@perry-mitchell
Copy link
Owner

I'll definitely add a method for making this easier, like a promise-based getReadStream() that will resolve with the stream and headers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants