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

feat: stream.pipeline #147

Merged
merged 1 commit into from May 18, 2020
Merged

feat: stream.pipeline #147

merged 1 commit into from May 18, 2020

Conversation

ronag
Copy link
Member

@ronag ronag commented May 17, 2020

Fixes: #106

stream.pipeline(
  fs.createReadStream('source.raw'),
  client.pipeline({
    path: '/',
    method: 'PUT',
  }, ({ statusCode }) => {
    if (statusCode !== 201) {
      throw new Error('invalid response')
    }
  }),
  fs.createReadStream('response.raw'),
  (err) => {
    if (err) {
      console.error('failed')
    } else {
      console.log('succeeded')
    }
  }
)

@ronag
Copy link
Member Author

ronag commented May 17, 2020

This could use some optimization. But I'm putting in place for now so that people use it instead of rolling their own. That way once we optimize this everyone will reap the benefits.

@ronag
Copy link
Member Author

ronag commented May 17, 2020

@szmarczak

@ronag ronag force-pushed the pipeline branch 4 times, most recently from 7b945f6 to f325515 Compare May 17, 2020 19:43
@ronag

This comment has been minimized.

lib/client.js Outdated Show resolved Hide resolved
@ronag ronag force-pushed the pipeline branch 2 times, most recently from f632d9d to 87ae87b Compare May 17, 2020 21:40
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ronag ronag merged commit ca30a7c into nodejs:master May 18, 2020
@ronag ronag mentioned this pull request May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pipeline Compat
2 participants