Skip to content

Commit add2990

Browse files
lcrespomdefunctzombie
authored andcommitted
Added section explaining why is async mode recommended (#444)
1 parent a5ecd97 commit add2990

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ bcrypt.compareSync(myPlaintextPassword, hash); // true
142142
bcrypt.compareSync(someOtherPlaintextPassword, hash); // false
143143
```
144144

145+
### Why is async mode recommended over sync mode?
146+
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.
147+
145148
## API
146149

147150
`BCrypt.`

0 commit comments

Comments
 (0)