Advertisement
Guest User

Create an Array of Strings in Node from a URL

a guest
Jul 10th, 2023
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const getScript = async (url) => {
  2.   const responce = await fetch(url);
  3.   const data = await responce.text();
  4.   return data.split("\n");
  5. };
  6.  
  7. const main = async () => {
  8.   const httpProxies = await getScript(
  9.     "https://raw.githubusercontent.com/monosans/proxy-list/main/proxies/http.txt"
  10.   );
  11.  
  12.   // Use httpProxies vaiable anywhere inside the main fuction scope
  13.   console.log(httpProxies.length); // 400+
  14. };
  15.  
  16. (async () => await main())();
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement