pvorb/node-md5

Heap out of memory with 227MB data stream.

rayjennings3rd opened this issue · 3 comments

Error with 227MB data stream:

let hash = md5(data.Body);

FATAL ERROR: invalid table size Allocation failed - JavaScript heap out of memory

Hit this same issue with 155 MB stream
FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory

I also encountered the same problem, and fixed it by using crypto from node. I think this lib is only useful when running in browser.

    const crypto = require("crypto");
    let md5 = crypto.createHash('md5').update(data).digest("hex");
pvorb commented

Use @uushuo's suggestion when you want to hash a large stream of data.

Why would anyone want to use MD5 for files in 2017/2018?