Skip to content

Fix using both objectMode and encoding options - #736

Merged
sindresorhus merged 1 commit into
mainfrom
fix-encoding-object
Jan 25, 2024
Merged

sindresorhus merged 1 commit into
mainfrom
fix-encoding-object

Conversation

@ehmicky

@ehmicky ehmicky commented Jan 25, 2024 •

Copy link
Copy Markdown
Collaborator

This fixes using both:

  • Transforms in objectMode
  • The encoding option with values like hex or base64

When a transform in objectMode returns an object, encoding: 'base64' should be a noop.

When a transform in objectMode returns a string or an Uint8Array, encoding: base64 can work. However, it must operate chunk-wise instead of line-wise, since consumers of streams in objectMode might assume for emitted chunks to be independent from each other. For example, we will make that assumption with #706: we will emit one line at a time in objectMode, and would assume to be encoded separately from the next one.

Loading
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