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

327
Views
¿Por qué stdout.write() no funciona en Terminal?

Soy novato en Node JS .

Estoy tratando de probar la solicitud cURL en mi localhost:3000 . Estoy usando el editor de texto Sublime Text 4 . La solicitud de cURL en la Terminal de Windows funciona bien, pero la barra de carga no aparece en la terminal. En cambio, aparece en Sublime Text Console .

Consola de texto sublime

Aquí está la salida de terminal sin barra de carga

Salida de terminal de Windows

He probado el siguiente código:

 const chalk = require("chalk"); const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args)); const express = require("express"); const app = express(); const processes = require("process"); const rdl = require("readline"); class LoadingBar { constructor(size) { this.size = size; this.cursor = 0; this.timer = null; } start() { processes.stdout.write("\x1B[?25l"); processes.stdout.write("["); for (let i = 0; i < this.size; i++) { processes.stdout.write("-"); } processes.stdout.write("]"); this.cursor = 1; rdl.cursorTo(processes.stdout, this.cursor, 0); this.timer = setInterval(() => { processes.stdout.write("#"); this.cursor++; if (this.cursor >= this.size) { clearTimeout(this.timer); processes.stdout.write("\x1B[?25h"); } }, 100); } } const loader = new LoadingBar(25); const obj = { "Response": 200, "Operation": 'successful', }; app.get("/response", (req, res) => { loader.start(); res.json(obj); }); app.listen(3000, () => { console.log("Server running on port 3000"); });

Quiero hacer una solicitud de cURL desde la Terminal y luego aparecerá la barra de carga y luego obtendré el obj . Pero por alguna razón, stdout.write() no funciona en Terminal. ¿Qué tengo que hacer?

about 4 years ago · Santiago Gelvez
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!