Skip to content

Commit

Permalink
Added section explaining why is async mode recommended (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcrespom authored and defunctzombie committed Sep 11, 2016
1 parent a5ecd97 commit add2990
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ bcrypt.compareSync(myPlaintextPassword, hash); // true
bcrypt.compareSync(someOtherPlaintextPassword, hash); // false
```

### Why is async mode recommended over sync mode?
If you are using bcrypt on a simple script, using the sync mode is perfectly fine. However, if you are using bcrypt on a server, the async mode is recommended. This is because the hashing done by bcrypt is CPU intensive, so the sync version will block the event loop and prevent your application from servicing any other inbound requests or events.

## API

`BCrypt.`
Expand Down

0 comments on commit add2990

Please sign in to comment.