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

120
Views
¿Cómo puedo obtener el valor d de process.stdout.write (d)?

Tengo esa 'd' donde se almacena el token de acceso, ¿cómo puedo obtener este valor de él? Si estoy usando console.log (d) , obtengo esto:

 <Buffer 7b 22 61 63 63 65 73 73 5f 74 6f 6b 65 6e 22 3a 22 65 61 38 30 66 32 30 35 38 38 32 37 34 64 37 32 62 61 64 66 30 36 31 37 64 36 37 62 36 65 34 38 22 ... 362 more bytes>

Probé con toString(),str='',str+=d pero no puedo obtenerlo

 const auth=()=>{ const data=querystring.stringify({ grant_type: 'client_credentials', client_id: 'x', client_secret: 'x', }) var options = { port:443, host: 'rest.sandbox.eu.zuora.com', path:'/oauth/token', headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': data.length }, method: 'POST', }; const req=https.request(options,(res)=>{ res.on('data', (d) => { process.stdout.write(d) }).on('end',()=>{ console.log("Yay"); }); }) req.write(data) req.end() } auth()
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Prueba algo como esto (no probado)

 const auth=()=>{ const data=querystring.stringify({ grant_type: 'client_credentials', client_id: 'x', client_secret: 'x', }) var options = { port:443, host: 'rest.sandbox.eu.zuora.com', path:'/oauth/token', headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': data.length }, method: 'POST', }; const req=https.request(options,(res)=>{ let body = [] res.on('data', (d) => { body.push(d) }).on('end',()=>{ try { console.log(JSON.parse(Buffer.concat(body).toString())); } catch(e) { console.log('some error') } }); }) req.write(data) req.end() } auth()
about 4 years ago · Juan Pablo Isaza Report

0

No estoy seguro de cómo está usando toString , pero si invoco toString() , como

 theString = d.toString()

esto funciona para mi.

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!