Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

200
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda