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

178
Vistas
ENOENT error on xml2js but file did exists

const xml2js = require('xml2js');
const fs = require('fs');

fs.readFile('https://www.tcmb.gov.tr/kurlar/today.xml', (err, data) => {
    if(err) console.log(err);
    var data = data.toString().replace("\ufeff", "");
    xml2js.parseStringPromise(data, (err, res) => {
        if(err){
            console.log(err);
        } else {
            console.log(res);
        }
    });
});
This is my code in nodejs I try to get data on a https link with xml2js first by using the way it says in the npm page pf xml2js it gives some error and when I chechk on web I find solution of using with fs but still geting this error enter image description here

I know the directory exists because if you go to link used in code it shows something but in code just gives error if someone can help I will be very happy

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

fs can only access file in your system, you should request the URL using http/https or even better try axios

const axios = require('axios')

axios.get('https://www.tcmb.gov.tr/kurlar/today.xml').then((response) => {
  const data = response.data
  xml2js.parseString(data, (err, res) => {
        if(err){
            console.log(err);
        } else {
            console.log(res);
        }
   })
})

about 4 years ago · Juan Pablo Isaza Denunciar
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