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

87
Views
JavaScript Sequental operation

What is the best way/pattern to perform sequental operations in JS(NodeJS)? E.g. Create folder->copy file->edit file->etc. This is stand-alone app, so thread-blocking oprations is ok(Sync).

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Don't. Get in the habit of writing async code in node everywhere, even if it doesn't need to be. It's just good practice, prevents refactoring a bunch of stuff in the future, and with modern JS it's simple to write:

import { mkdir, copyFile } from 'fs/promises';

async function createThing() {
    await mkdir('/path/to/dir');
    await copyFile(src, dest);
    ...
}
about 4 years ago · Juan Pablo Isaza Report

0

Just use async/await for sequential, asynchronous operations. No need to write sync code that you'll regret later. Also, depending on the application, you might get trivial speedup opportunities by doing things concurrently.

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!