title: Locking on an object?
body: <p>I'm very new to Node.js and I'm sure there's an easy answer to this, I just can't find it :(</p>
  
  <p>I'm using the filesystem to hold 'packages' (folders with a status extensions 'mypackage.idle') Users can perform actions on these which would cause the status to go to something like 'qa', or 'deploying' etc... If the server is accepting lots of requests and multiple requests come in for the same package how would I check the status and then perform an action, which would change the status, guaranteeing that another request didn't alter it before/during the action took place?</p>
  
  <p>so in c# something like this</p>
  
  <pre><code>lock (someLock) { checkStatus(); performAction(); }
  </code></pre>
  
  <p>Thanks :)</p>