Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

151
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda