mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Refactor: drop Bun.inspect and Bun.version
This commit is contained in:
@@ -69,13 +69,12 @@ export function fetchRemoteTextByLine(url: string | URL) {
|
||||
return fetchWithRetry(url, defaultRequestInit).then(createReadlineInterfaceFromResponse);
|
||||
}
|
||||
|
||||
export async function readFileIntoProcessedArray(file: string | URL | BunFile) {
|
||||
if (typeof file === 'string') {
|
||||
file = Bun.file(file);
|
||||
} else if (!('writer' in file)) {
|
||||
file = Bun.file(file);
|
||||
export async function readFileIntoProcessedArray(file: string | BunFile | FileHandle) {
|
||||
const results = [];
|
||||
for await (const line of readFileByLine(file)) {
|
||||
if (processLine(line)) {
|
||||
results.push(line);
|
||||
}
|
||||
}
|
||||
|
||||
const content = await file.text();
|
||||
return content.split('\n').filter(processLine);
|
||||
return results;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user