Move TextLineStream to foxts, adopt skipEmptyLines
Some checks failed
Build / Build (push) Has been cancelled
Build / Diff output (push) Has been cancelled
Build / Deploy to Cloudflare Pages (push) Has been cancelled
Build / Deploy to GitHub and GitLab (push) Has been cancelled

This commit is contained in:
SukkaW
2025-03-11 01:05:14 +08:00
parent ac200f67c5
commit c9ebec077f
3 changed files with 4 additions and 84 deletions

View File

@@ -1,7 +1,7 @@
import fs from 'node:fs';
import readline from 'node:readline';
import { TextLineStream } from './text-line-transform-stream';
import { TextLineStream } from 'foxts/text-line-stream';
import type { ReadableStream } from 'node:stream/web';
import { TextDecoderStream } from 'node:stream/web';
import { processLine, ProcessLineStream } from './process-line';
@@ -31,7 +31,7 @@ export const createReadlineInterfaceFromResponse: ((resp: UndiciResponseData | U
const resultStream = webStream
.pipeThrough(new TextDecoderStream())
.pipeThrough(new TextLineStream());
.pipeThrough(new TextLineStream({ skipEmptyLines: processLine }));
if (processLine) {
return resultStream.pipeThrough(new ProcessLineStream());