Polyman Documentation - v2.2.2
    Preparing search index...
    • Downloads a file from a URL using HTTPS. Automatically handles HTTP redirects (301, 302).

      Parameters

      • url: string

        The URL to download from

      Returns Promise<string>

      The downloaded file content as a string

      If download fails or HTTP status is not 200/301/302

      const testlibContent = await downloadFile(
      'https://raw.githubusercontent.com/MikeMirzayanov/testlib/master/testlib.h'
      );
      fs.writeFileSync('testlib.h', testlibContent);