Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
Guarde la fuente Html del navegador con JS

Me gustaría crear una aplicación de lista Html simple en mi computadora local con funcionalidad de guardado localmente, nuevos elementos de lista agregados a la lista y guardados. Estaba buscando en línea, pero solo encontré soluciones complicadas que requerían un objeto de entrada para guardar. Me gustaría preguntar si el siguiente código puede funcionar con alguna modificación.

índice.html

 <html lang="en"> <head> <title>App</title> </head> <body> Content... <button onclick="save()">Save</button> </body> <script src="setup.js"></script> </html>

configuración.js

 async function save(content){ let fileData = new File([""], "index.html"); let stream = fileData.createWritable(); let text = "text"; await stream.write(text); await stream.close();
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Si está ejecutando un navegador Chromium muy reciente, puede usar window.showSaveFilePicker. ([https://developer.mozilla.org/en-US/docs/Web/API/Window/showSaveFilePicker]) De los documentos:

 function getNewFileHandle() { const opts = { types: [{ description: 'Text file', accept: {'text/plain': ['.txt']}, }], }; return window.showSaveFilePicker(opts); } async function writeFile(fileHandle, contents) { // Create a FileSystemWritableFileStream to write to. const writable = await fileHandle.createWritable(); // Write the contents of the file to the stream. await writable.write(contents); // Close the file and write the contents to disk. await writable.close(); }
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda