mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Make CI Faster / Readline util
This commit is contained in:
@@ -1,8 +1,19 @@
|
||||
// @ts-check
|
||||
const fs = require('fs');
|
||||
const { fetchWithRetry } = require('./fetch-retry');
|
||||
const readline = require('readline');
|
||||
const { Readable } = require('stream');
|
||||
|
||||
/**
|
||||
* @param {string} path
|
||||
*/
|
||||
module.exports.readFileByLine = (path) => {
|
||||
return readline.createInterface({
|
||||
input: fs.createReadStream(path, { encoding: 'utf-8' }),
|
||||
crlfDelay: Infinity
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {import('undici').Response} resp
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user