Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

198
Views
How to get file from URL or FTP into variable using Cloudflare Worker?

I am trying to get the data from a KML file that is downloaded via one of the following two URLs:

https://ftp.cpc.ncep.noaa.gov/GIS/us_tempprcpfcst/ (specifically the seaskmls_latest.zip files) or https://www.cpc.ncep.noaa.gov/products/predictions/30day/lead14_temp.kml

The problem that I am having is that I need to get data from one of these sources into a variable in a Cloudflare Worker in order to process it and send it on to my React app. Once I have the data I am confident that I can do what I need but I have been unsuccessful in my attempts to get the data.

I have tried to use a basic fetch request from React (which didn't return any data)

 fetch('https://www.cpc.ncep.noaa.gov/products/predictions/30day/lead14_temp.kml', { method: 'GET', mode: 'no-cors' })
      .then(res => res.text());

I have tried using an XMLHttpRequest from React that I found in another thread (again, no dice)

function load(url, callback) {
    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function () {
      if (xhr.readyState === 4 && xhr.status === 200) callback(xhr.responseText);
    };
    xhr.open("GET", url, true);
  }
  
  load("https://www.cpc.ncep.noaa.gov/products/predictions/30day/lead14_temp.kml", function (contents) {
    console.log(contents);
  });

And I have tried to use an FTP package (basic-ftp) from Cloudflare that I couldn't get to import properly due to dependency issues that I don't know how to resolve.

I feel like there is something basic here that I am missing. If anyone could point me in the correct direction or help me out with this I would be very grateful!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!