I am implementing encryption/decryption of logs, and came across a sample code on another SO question that used the node crypto library. In the code, its mentioned that the buffers storing the plaintext and cipher key need to be cleared after the encryption / decryption process so that it doesn't "linger in the memory".
I understand this concept, but how does one clear a buffer? I've tried searching on SO and the official node documentation for buffer object, but I couldn't find much. So far, I've considered: setting the variable to null trigger Node's garbage collection, or using Buffer.fill()
.
Thanks for any help!