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

Duplex.from({writable, readable}) in object mode incompatibility #92

Open
sergey-s-betke opened this issue Oct 26, 2024 · 6 comments
Open

Comments

@sergey-s-betke
Copy link

Please, add properties readableObjectMode, writableObjectMode for compatibility with Duplex.from({writable, readable}) for writable.objectMode === true.

@sergey-s-betke
Copy link
Author

sergey-s-betke commented Oct 26, 2024

Workaround:

const readable: streams.Duplex = new streams.PassThrough({ objectMode: true, emitClose: true });
const writable: NodeJS.WritableStream = vfs.dest(containerDirectoryPath, _options.destOptions);

Object.defineProperty(writable, 'writableObjectMode', { enumerable: true, configurable: true, value: true });

return streams.Duplex.from({ writable, readable });

@mafintosh
Copy link
Owner

Whats breaking for you without this?

@sergey-s-betke
Copy link
Author

I use streams.Duplex.from({ writable, readable }) in my gulp plugin. And this stream must work in object mode, and must accept Vinyl object. Without this workaround duplexify node code create Duplex stream with objectMode == false from streamx streams (gulp dest stream, for example).

@mafintosh
Copy link
Owner

I see. I dont streamx streams are really meant to be turned into node streams, ie node streams have a ton of stuff.

Would suggest using https://github.com/mafintosh/stream-composer for making the duplex etc.

@sergey-s-betke
Copy link
Author

I see. I dont streamx streams are really meant to be turned into node streams, ie node streams have a ton of stuff.

Would suggest using https://github.com/mafintosh/stream-composer for making the duplex etc.

ok, thank You. But can You add typescript types declaration for streamx and stream-composer?.

@mafintosh
Copy link
Owner

I dont write typescript so wouldnt know how to do that. Feel free to send a PR to help. Its pretty stable these days so few things change.

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

No branches or pull requests

2 participants