-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support for duplex streams? #7
Comments
Will take a look. If you have a small snippet that reproduces the issue, that would be helpful |
@stevenvachon in 2.0.0 I rewrote the logic with the native stream primitives, this might solve it. |
Hmm, I get nothing with 2.0.0: import got from 'got';
import parseRobots from 'robots-txt-parse';
const getRobotsTxt = url => new Promise((resolve, reject) => {
got.stream(url, {
method: 'get',
throwHttpErrors: false
})
.on('error', reject)
.on('response', async stream => resolve(await parseRobots(stream)));
});
getRobotsTxt('https://svachon.com/robots.txt')
.then(console.log)
.catch(console.error); |
This seems to work for me: import got from 'got';
import parseRobots from 'robots-txt-parse';
const getRobotsTxt = async url => parseRobots(got.stream(url));
getRobotsTxt('https://svachon.com/robots.txt').then(console.log, console.error);
As for the original code, the following doesn't print anything for me, so I think it's something in import got from 'got';
const printRobotsTxt = url => {
got.stream(url)
.on('error', console.error)
.on('response', async stream => {
console.log('response received')
stream.on('data', console.log)
});
};
printRobotsTxt('https://svachon.com/robots.txt') |
I'm using |
Thanks |
|
@szmarczak Is there a reason why .on('response', async stream => {
stream.on('data', console.log)
}); doesn't put |
@Janpot you're using the |
I've had success in the past passing in a
Transform
stream, but a duplex stream is not resolving the promise.The text was updated successfully, but these errors were encountered: