mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Move TextLineStream to foxts, adopt skipEmptyLines
This commit is contained in:
@@ -2,7 +2,7 @@ import picocolors from 'picocolors';
|
||||
import { $$fetch, defaultRequestInit, ResponseError } from './fetch-retry';
|
||||
import { waitWithAbort } from 'foxts/wait';
|
||||
import { nullthrow } from 'foxts/guard';
|
||||
import { TextLineStream } from './text-line-transform-stream';
|
||||
import { TextLineStream } from 'foxts/text-line-stream';
|
||||
import { ProcessLineStream } from './process-line';
|
||||
|
||||
// eslint-disable-next-line sukka/unicorn/custom-error-definition -- typescript is better
|
||||
@@ -32,7 +32,7 @@ export async function fetchAssets(url: string, fallbackUrls: null | undefined |
|
||||
}
|
||||
const res = await $$fetch(url, { signal: controller.signal, ...defaultRequestInit });
|
||||
|
||||
let stream = nullthrow(res.body, url + ' has an empty body').pipeThrough(new TextDecoderStream()).pipeThrough(new TextLineStream());
|
||||
let stream = nullthrow(res.body, url + ' has an empty body').pipeThrough(new TextDecoderStream()).pipeThrough(new TextLineStream({ skipEmptyLines: processLine }));
|
||||
if (processLine) {
|
||||
stream = stream.pipeThrough(new ProcessLineStream());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user