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

285
Views
Cómo crear un archivo rtf desde un Blob en Javascript

Estoy tratando de crear un rtf a partir de mis variables de estado, el archivo se crea pero está dañado, no puedo abrirlo. ¿Cómo puedo convertir una cadena en un archivo rtf?

ingrese la descripción de la imagen aquí

 const Example = () => { const [headers, setHeaders] = React.useState(['Header 1', 'Header 2', 'Header 3']); const [content, setContent] = React.useState([['Content 1', 'Content 2', 'Content 3'], ['Content 4', 'Content 5', 'Content 6']]) const [downloadUrl, setDownloadUrl] = React.useState(''); const createDownUrl = () => { const fileHeaders = headers.join(' '); const fileContent = content.map(i => i.join(' ')).join('\r\n'); const data = new Blob([`${fileHeaders}\r\n${fileContent}`]); setDownloadUrl(URL.createObjectURL(data)) } return ( <div> <button onClick={() => createDownUrl()}> Create download link </button> {downloadUrl && <a download={'Example.rtf'} href={downloadUrl}>Download</a>} </div> ); }; // Render it ReactDOM.render( <Example />, document.getElementById("react") );
 <script src="https://cdnjs.cloudflare.com/ajax/libs/react/17.0.1/umd/react.production.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.1/umd/react-dom.production.min.js"></script> <div id="react"></div>

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