(file: string)
| 54 | * @param file |
| 55 | */ |
| 56 | const proxyFromFile = async (file: string) => { |
| 57 | try { |
| 58 | const data = (await fromCallback(cb => readFile(file, { encoding: 'utf-8' }, cb))) as string; |
| 59 | const proxyList = data.split('\n'); |
| 60 | if (!proxyList.length) { |
| 61 | throw new Error('Proxy file is empty'); |
| 62 | } |
| 63 | return proxyList; |
| 64 | } catch (error) { |
| 65 | throw error.message; |
| 66 | } |
| 67 | }; |
| 68 | |
| 69 | /** |
| 70 | * Load session list from a file |
no outgoing calls
no test coverage detected