Skip to content

Commit

Permalink
transform merged stream
Browse files Browse the repository at this point in the history
  • Loading branch information
leolambo committed May 22, 2024
1 parent 898d964 commit e0577ec
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from 'axios';
import { Request, Response } from 'express';
import { Readable, Stream, Writable } from 'stream';
import { Readable, Stream, Transform, Writable } from 'stream';

export class ExternalApiStream extends Readable {
url: string;
Expand Down Expand Up @@ -145,4 +145,14 @@ export class ExternalApiStream extends Readable {
});
};
}
}

export class MergedStream extends Transform {
constructor() {
super({ objectMode: true });
}

async _transform(data: any, _, done) {
done(null, data);
}
}

0 comments on commit e0577ec

Please sign in to comment.