fast-proxy-balancer
Version:
Smart and flexible proxy balancer for Node.js
20 lines • 639 B
JavaScript
import { readFile } from 'fs/promises';
/**
* Loads proxies from a file. Lines starting with "#" are ignored.
* @param filePath - Path to the proxy list file
* @returns An array of proxy strings (e.g., IP:Port)
*/
export async function loadProxiesFromFile(filePath) {
try {
const data = await readFile(filePath, 'utf8');
return data
.split('\n')
.map(line => line.trim())
.filter(line => line && !line.startsWith('#'));
}
catch (error) {
console.error(`Error reading proxy file: ${error.message}`);
return [];
}
}
//# sourceMappingURL=loadProxy.js.map