Skip to content

refactor: createAddStream#303

Draft
ronag wants to merge 1 commit intolbdremy:masterfrom
ronag:compose-pipeline
Draft

refactor: createAddStream#303
ronag wants to merge 1 commit intolbdremy:masterfrom
ronag:compose-pipeline

Conversation

@ronag
Copy link
Copy Markdown

@ronag ronag commented Nov 10, 2021

Just a quick suggestion on how to improve the implementation for Node 16+.

@ronag ronag marked this pull request as draft November 10, 2021 08:06
Comment thread lib/solr.ts
Comment on lines +303 to +309
return stream.compose(
JSONStream.stringify(),
undici.pipeline(optionsRequest.url, optionsRequest, ({ statusCode, headers, body }) => {
// TODO:
return body
})
)
Copy link
Copy Markdown
Author

@ronag ronag Nov 10, 2021

Choose a reason for hiding this comment

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

Node 14+

const jsonStreamStringify = JSONStream.stringify();
const req = undici.pipeline(optionsRequest.url, optionsRequest, ({ statusCode, headers, body }) => {
  // TODO: statusCode & headers
  return body;
});
return duplexer(jsonStreamStringify, pipeline(jsonStreamStringify, req, () => {}));

@kibertoad kibertoad self-assigned this Dec 9, 2021
@kibertoad
Copy link
Copy Markdown
Collaborator

Thank you! I'll try to finish this in coming days.

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.

2 participants