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

157
Vistas
how to save and read file from %temp% using node js?

This is the code that creates a blob file and save that in folder, i want to save the screen.webm into the windows temp folder and read the files from the same folder later on

async function handleStop(e) {
    const blob = new Blob(recordedChunks, {
        type: 'video/webm'
    });

    const buffer = Buffer.from(await blob.arrayBuffer());

    const { filePath } = await dialog.showSaveDialog({
        buttonLabel: 'Save video',
        defaultPath: `vid-${Date.now()}.webm`
    });

    fs.writeFile('screen.webm', buffer, function(err){
        if(err) throw err;
        console.log(err)
    })
    if (filePath) {
        writeFile(filePath, buffer, () => console.log('video saved successfully!'));
    }

    while(recordedChunks.length>0){
        recordedChunks.pop()
    }
}

this function is broken as it will save the file in the same folder in which the js file is. and as backup i also added a user prompt so that user can save the file in the desired folder. i am usnig Electron JS to build a screen recorder.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

os.tmpdir() returns the operating system's default directory for temporary files as a string

const os = require('os');

os.tmpdir();
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