Skip to content

Commit

Permalink
Fix: avoid init undici when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Jan 10, 2025
1 parent 8799209 commit f25bb58
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Build/lib/fetch-text-by-line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { TextLineStream } from './text-line-transform-stream';
import type { ReadableStream } from 'node:stream/web';
import { TextDecoderStream } from 'node:stream/web';
import { processLine, ProcessLineStream } from './process-line';
import { $$fetch } from './fetch-retry';
import type { UndiciResponseData } from './fetch-retry';
import type { Response as UnidiciWebResponse } from 'undici';

Expand Down Expand Up @@ -69,7 +68,7 @@ export const createReadlineInterfaceFromResponse: ((resp: UndiciResponseData | U
};

export function fetchRemoteTextByLine(url: string, processLine = false): Promise<AsyncIterable<string>> {
return $$fetch(url).then(resp => createReadlineInterfaceFromResponse(resp, processLine));
return import('./fetch-retry').then(({ $$fetch }) => $$fetch(url)).then(resp => createReadlineInterfaceFromResponse(resp, processLine));
}

export async function readFileIntoProcessedArray(file: string /* | FileHandle */) {
Expand Down

0 comments on commit f25bb58

Please sign in to comment.