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

440
Views
La aplicación de nodo no escribe en un archivo, no hay registros de errores

Estoy tratando de usar Capture-Website, que guarda capturas de pantalla de páginas web en un archivo.

Solía funcionar perfectamente hasta que reinicié el servidor.

Ahora el código se ejecuta sin errores, pero NO guarda una captura de pantalla en el disco

Aquí está mi código:

 import http from 'http'; import url from 'url'; import querystring from 'querystring'; var mainURL; const hostname = 'localhost'; const port = 8080; import captureWebsite from 'capture-website'; const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World!\n'); var url_parts = url.parse(req.url, true); var query = url_parts.query; mainURL = query.url; console.log(mainURL); (async () => { try { await captureWebsite.file('https://'+mainURL, mainURL+".jpg", { overwrite:true, type: 'jpeg', quality: 0.5, width:1480, height:800, delay: 1 }); } catch(err) { console.log(err); } })(); });

No hay errores. También intenté ejecutar pm2 logs , tampoco hubo errores.

Aquí está el código de escritura de archivos que pertenece al paquete capture-website :

 captureWebsite.file = async (url, filePath, options = {}) => { const screenshot = await internalCaptureWebsite(url, options); await fs.writeFile(filePath, screenshot, { flag: options.overwrite ? 'w' : 'wx', }); };
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Lo más probable es que su problema sea que no puede usar barras inclinadas (/) en los nombres de los archivos. Esto se debe a que las carpetas están separadas por barras.

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!