Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7188167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:00:41+00:00 2026-05-28T19:00:41+00:00

What is the best practice for coordinating access to files in node.js? I’m trying

  • 0

What is the best practice for coordinating access to files in node.js?

I’m trying to write an http based file uploader for very large files (10sGB) that is resumable. I’m trying to figure out what the best approach is to handle two people trying to upload the same file at the same time… I’m also trying to think ahead to the possibility where more than one copy of the node.js http server is running behind a load balancer, which means catching duplicate uploads can’t rely on just the code itself.

In python, for example, you can create a file by passing the correct flags to the open() call to force an atomic create. Not sure if the default node.js open new file is atomic.

Another option I thought of, but don’t really want to pursue, is using a database with an async driver that supports atomic transactions to track this state…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:00:42+00:00Added an answer on May 28, 2026 at 7:00 pm

    I found this on HackerNews under a response to someone complaining about some of the same things in node.js. I’ll put it here for completeness. This allows me to at least lock some file writes in node.js like I wanted to.

    IsaacSchlueter 4 hours ago | link

    You can open a file with O_EXCL if you pass in the open flags as a
    number. (You can find them on require(“constants”), and they need to
    be binary-OR’ed together.) This isn’t documented. It should be. It
    should probably also be exposed in a cleaner way. Most of the rest of
    what you describe is APIs that need to be polished and refined a bit.
    The boundaries are well defined at this point, though. We probably
    won’t add another builtin module at this point, or dramatically expand
    what any of them can do. (I don’t consider seek() dramatic, it’s just
    tricky to get right given JavaScript’s annoying Number problems.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A best practice question - how are very large websites best structured with Java.
The 'best practice' (as I see it) to atomically create a new file, is
What is the best practice to scale a node app on Heroku? When should
Of course it is best practice to declare all methods in the header file,
What is the best-practice for gracefully exiting a Node.js program from an external signal?
What would you consider best practice to store constants (like file names for property
Best practice is to use unique ivs, but what is unique? Is it unique
Short best practice question: If an object A is injected into another object B,
What's the best practice for making sure that certain ajax calls to certain pages
What is best practice when creating your exception classes in a .NET solution: To

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.