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

221
Views
cómo obtener el nombre de archivo actual en el nodo js cuando se usa el tipo ES

módulo p.js

 import url from 'url'; export function _file(){ return url.fileURLToPath(import.meta.url) }

índice.js

 import {_file} from './p.js'; console.log(_file()); // returns p.js instead of index.js

Quiero que se devuelva la dirección del archivo index.js.

Sé que puedo pasar import.meta.url en index.js como parámetro de método, pero quiero saber si hay otra forma o no.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No hay.

El módulo conoce su propio nombre de archivo.

No conoce el nombre de algún archivo a cierta distancia arbitraria en la pila.

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