Questions tagged [through2]

Available as an npm module, through2 is a wrapper around Node's core stream.Tranform class that allows for simpler object stream creation.

see https://github.com/rvagg/through2

23 questions
0
votes
1 answer

node stream not finish but emit end

I am reading this and wrote my codes based on examples. My codes: const through = require('through2'); const bluebird = require('bluebird'); function streamToPromise(stream) { return new Promise(function(resolve, reject) { stream.resume(); …
BAE
  • 8,550
  • 22
  • 88
  • 171
0
votes
1 answer

Make sure promise resolved inside transformFunction

I am studying through2 and sequelize. My codes: return Doc.createReadStream({ where: { /*...*/ }, include: [ { /*...*/ }, ], }) .pipe(through({ objectMode: true }, (doc, enc, cb) => { Comment.findOne(null, {…
BAE
  • 8,550
  • 22
  • 88
  • 171
0
votes
1 answer

Converting WriteStream to TransformStream

I have a (somewhat weird) writable stream that I need to convert to a transform stream. The writable stream, normally, sits at the end of a pipe chain and emits custom events once it has collected enough data for its output. I want it to go in the…
mathan
  • 133
  • 2
  • 13
0
votes
0 answers

Transform stream JavaScript for the browser

I have a file that makes use of the library through2 to handle transform streams. The only problem with this library is that it doesn't run on the browser. Is there a library I can use that does something similar to through2 and runs on the client? …
helfi
  • 125
  • 3
  • 10
0
votes
2 answers

Node - Abstracting Pipe Steps into Function

I'm familiar with Node streams, but I'm struggling on best practices for abstracting code that I reuse a lot into a single pipe step. Here's a stripped down version of what I'm writing…
AdamPat
  • 101
  • 1
  • 10
0
votes
1 answer

Apply another gulp plugin in my own gulp plugin using through2

I am writing my own gulp plugin which looks like this... var through2 = require('through2'); var order = require('gulp-order'); module.exports = function() { return through2.obj(function(file, encoding, callback) { callback(null,…
mikep
  • 5,880
  • 2
  • 30
  • 37
0
votes
1 answer

Pipe image through graphics magic only half complete

I am trying to set up a transform stream to pipe an image through with GM https://github.com/aheckmann/gm. So I can do something like: readStream.pipe(resize()).pipe(writeStream); I have used through2 along with gm to try and achieve this. It works…
wazzaday
  • 9,474
  • 6
  • 39
  • 66
0
votes
2 answers

Access file name in the transformed gulp stream

I have the following gulp task configured: var assets = plugins.useref.assets({searchPath: './'}), css = plugins.filter('**/main.css'), html = plugins.filter('**/*.html'); return gulp .src(config.html.srcheader) …
Ssey
  • 65
  • 8
1
2