yosiweinreb yosiweinreb - 10 months ago 88
Node.js Question

Nodejs. Asynchronous Encryption and Decryption

I was wondering why there isn't any async function for encryption & decryption on the native nodejs crypto module or any other modules i failed to find.
Either symmetric or asymmetric.

I want to use this functionallity on a server request, and was worried about blocking and slowing the server on a large scale of requests if it'll not be async.

Maybe my worries are too many, and the intensity of the the encrypt/decrypt process isn't too much.


Answer Source

The only possibility you have to obtain async Encryption/Decryption is to delegate these operations to another process. The only async operations you can do in nodejs are I/O operations while pure computation operations will block your process until they have finished. Remember that node is single-thread.