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

147
Views
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 answers
Answer question

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 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!