Available as an npm module, through2 is a wrapper around Node's core stream.Tranform class that allows for simpler object stream creation.
Questions tagged [through2]
23 questions
10
votes
1 answer
How to defer stream read invocation
I'm still trying to grok my way through streams in general. I have been able to stream a large file using multiparty from within form.on('part'). But I need to defer the invocation and resolve the stream before it's read. I have tried PassThrough,…

garajo
- 736
- 4
- 19
9
votes
3 answers
Why is my console logging: `TimeoutOverflowWarning: 4294967296000 does not fit into a 32-bit signed integer`
I am following the course stream-adventure. One of the assignments is to make an http server which converts all the requests to uppercase and return it in the response.
Now I managed to get it working and the assignment passes. However, the console…

Remi
- 4,663
- 11
- 49
- 84
4
votes
1 answer
Why does vinyl.isVinyl() return false for vinyl files emitted by gulp?
I am learning about the gulp source code and tried to write a gulp plugin.
Now I am confused about something.
This is my plugin code below:
module.exports = function(){
return through2.obj(function(file,encode,callback){
…

kwoktung
- 572
- 1
- 4
- 12
3
votes
1 answer
NodeJS: Actual native substitute for "through2" for intervention to steams in 2021
From the through2 documentation:
Do you need this?
Since Node.js introduced Simplified Stream Construction, many uses of
through2 have become redundant. Consider whether you really need to
use through2 or just want to use the 'readable-stream'…

Takeshi Tokugawa YD
- 670
- 5
- 40
- 124
3
votes
1 answer
Get JSON/String of through2 stream?
I have a bunch of zip files, each file contains a .config file.
I want to iterate each zip, unzip it, read the config file, and use that config file to upload the zip file somewhere.
gulp.task('deploy-zips', function () {
const filter =…

Phill
- 18,398
- 7
- 62
- 102
2
votes
0 answers
Long Object Stream with Asynchronous Transform Ending Too Soon
I am piping the response from a Node request into a transform stream using through2Concurrent. This response comes in as a buffer and is parsed to an object using JSONStream. That then gets piped into my transform stream. The transform stream…

Bobby R
- 91
- 1
- 6
2
votes
1 answer
Data not being transformed Node.js Transform streams
I'm trying to make a transform stream flow that is taking data from socket.io, converting it to JSON, and then sending it to stdout. I am totally perplexed as to why data just seems to go right through without any transformation. I'm using the…

coolboyjules
- 2,300
- 4
- 22
- 42
2
votes
1 answer
Creating multiple files from Vinyl stream with Through2
I've been trying to figure this out by myself, but had no success yet. I don't even know how to start researching for this (though I've tried some Google searchs already, to no avail), so I decided to ask this question here.
Is it possible to return…

Daniel Bastos
- 143
- 2
- 10
1
vote
0 answers
Nodejs through2 stop writing streams after 32 chunks due to back pressure
first.js
let data = {}
const ingSelf = this
const prom = await new Promise((resolve, reject) => {
data = inputs.input[0].pipe(through2.obj(function (chunk, enc, next) {
const throughSelf = this
ingestionSelf.myFunction(node, {…

Venkat
- 3,447
- 6
- 42
- 61
1
vote
2 answers
gulp - wrap plugin (which uses through2) output with string
I would like to know how exactly can I manipulate the output of my Gulp plugin so, for example, no matter how many files are passed to the plugin, it will wrap the output with a string. Currently I cannot know when does the last file is done.
The…

vsync
- 118,978
- 58
- 307
- 400
0
votes
1 answer
How to inform browserify about extra dependencies within a transform module?
I created a browserify transform to transform .pug files to preparsed Ractive JSON objects. That operation requires to transform Pug files to HTML and then pass to the Ractive.parse() function.
What doesn't work after initial build is that when I…

ceremcem
- 3,900
- 4
- 28
- 66
0
votes
1 answer
“write after end” error in a server made with nodejs using through2-map
The first API request successfully send a response. However, when I do another GET request the error "write after end" is given.
When I turn off .pipe(addThing) then it does work on consecutive calls.
Is the through2-map function ending the…

Remi
- 4,663
- 11
- 49
- 84
0
votes
1 answer
Node.js: Why is the transform function of a Transform stream never getting called?
I am trying to write a custom transformer stream in Node.js 12. Specifically I take in json objects in a stream (Database driver) and return an object transformed. But my transformer functions never get called. I have also tried this by overriding…

Andre Lewis
- 396
- 1
- 4
- 10
0
votes
1 answer
Catch errors in promise resolved with stream concatenation in node js
I need to catch errors thrown inside a stream event in promise resolution. Something like
function foo(){
return new Promise((resolve,reject) => {
resolve(res.pipe(transfomrStream).pipe(through2.obj(function(obj, enc, callback) {
on('end',…
user7794336
0
votes
1 answer
Node JS async/await with multiple fs.writeFile using through2 (Gulp/Vinyl)
I'm using through2 to generate multiple files from a Gulp stream. I'm using NodeJS 10.6.0 so thought I'd make full use of async/await, but am not fully understanding the mechanics yet. Currently the through2 done() callback is being fired before all…

Gareth James
- 138
- 2
- 13