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

229
Views
Formando 'archivo nodepad en Node.js

Necesito ayuda con el formato de escritura de texto en el archivo nodepad en el nodo js. a continuación está mi código

 const fs = require('fs'); fs.writeFile('write.txt', '', err => {}); var text = []; var max_iteration = 226; for (let i = 101; i < max_iteration; i++) { if (i == 126) i = 201; let html = `[${i}](endpoint-internal-d70) auth = ${i} aors = ${i}callerid = voicebot101 <101> [${i}](auth-userpass) password = ${i} username = ${i} [${i}] (aor-single-reg)`; text.push(html); if (i + 1 === max_iteration){ display(text); console.log('Last loop:', i + 1); } } function display(text) { fs.writeFile('write.txt', JSON.stringify(text), err => { if (err) { console.log('Error writing file', err); } else { console.log('Successfully wrote file'); } }); }

y obtengo algo como esto: ["[101](endpoint-internal-d70)\n auth = 101\n aors = 101callerid = voicebot101 <101>\n \n...

Excepto que elimine los caracteres blancos blancos del archivo y formatee el texto de la siguiente manera:

 ["[101](endpoint-internal-d70) auth = 101 aors = 101callerid = voicebot101 <101>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

La cadena también cuenta las sangrías, así que elimine la sangría para corregir el formato extraño.

 let html = `[${i}](endpoint-internal-d70) auth = ${i} aors = ${i}callerid = voicebot101 <101> [${i}](auth-userpass) password = ${i} username = ${i} [${i}] (aor-single-reg)`;
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!