Closed ninjadynamics closed 3 years ago
This is quite weird, I have never seen an error remotely similar. This HTML file does not produce the error:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<script src="https://unpkg.com/fflate@0.7.1/umd/index.js"></script>
<script>
const res = fflate.zipSync({'test.txt': fflate.strToU8('Hey there!')});
console.log(res)
</script>
</body>
</html>
Could you provide extra info about your environment?
Thank you for the quick response!
I found the problem. It seems that adding a method to Object.prototype causes the recursion to happen. You can try it.
console.log(fflate.zipSync({'test.txt': fflate.strToU8('TEST A')}));
Object.prototype.bananas = function() { return "bananas" };
console.log(fflate.zipSync({'test.txt': fflate.strToU8('TEST B')}));
Modifying the object prototype is bound to cause issues, I'm surprised fflate
is the first library causing problems. The main issue with this is that the property is enumerable. If you set the property as non-enumerable, the problem does not occur.
Object.defineProperty(Object.prototype, 'x', {
enumerable: false,
value: function() { }
})
Let me know if this works for you.
This works! Thank you very much! 👍 I'm closing this issue now! :)
Hi!
I'm getting a recursion overflow error when trying to create a zip file using zipSync.
Browser console:
My HTML file (served via https):
<script src="https://unpkg.com/fflate@0.7.1/umd/index.js"></script>