Pipe a readable stream into browserify
See original GitHub issueIs there a way to pipe an already existing stream into a browserify instance? Here is an example of my use case:
fs.createReadStream('./my-entry-script.js')
.pipe(through2(function () {
// Some transform that pulls some meta data about the file and possibly
// preforms modifications on the content
}))
.pipe(browserify())
.pipe(someOutputStream);
I looked into the pipeline stuff here but did not see an easy way to hook into this. I would be willing to open up a PR to take a stab at this if there is not already something to handle this situation, just wanted to start a discussion before working on it 😃
Also, FWIW, I know there are ways to solve the exact use case above, but this is for integrating browserify into a larger ecosystem of stream based transforms for content management type app I am working on. So I know there are probably ways to solve the exact problem above with a concat stream and buffer, but I would really like to be able to do the duplex stream like above.
Issue Analytics
- State:
- Created 8 years ago
- Comments:7
Top GitHub Comments
@substack I am glad to hear that it is possible. Is my linked solution what you mean? Or is there a less hacky way?
If you can tell me the recommended solution I will try to find a place for it in the docs so anyone else with this question can easily find the answer. Thanks!!
EDIT - link: https://github.com/wesleytodd/rufio-filter-browserify/blob/master/index.js
I did manage to get a working solution, but I think there are some issues, and it is certainly hacked on top of browserify, so any help would be appreciated. Here is my implementation for reference: https://github.com/wesleytodd/rufio-filter-browserify/blob/master/index.js