I try to use following code to encrypt a file of 1 GB. But Node.js abort with \"FATAL ERROR: JS Allocation failed - process out of memory\". How can I deal with it?
I would simply use the Fileger to do it. It's a promise-based package and a clean alternative to the NodeJS filesystem.
const fileger = require("fileger")
const file = new fileger.File("./your-file-path.txt");
file.encrypt("your-password") // this will encrypt the file
.then(() => {
file.decrypt("your-password") // this will decrypt the file
})