I have a node js application that does some image processing on large files using sharp, which in turn uses nan to interface with node. When I load a very large image I get an error from nan that says
node: ../node_modules/nan/nan.h:679: Nan::MaybeLocal<v8::Object> Nan::NewBuffer(char*, size_t, node::Buffer::FreeCallback, void*): Assertion `length <= imp::kMaxLength && "too large buffer"' failed.
Aborted (core dumped)
You can see line 679 of nan.h here
But in summary it says this:
// arbitrary buffer lengths requires
// NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION
assert(length <= imp::kMaxLength && "too large buffer");
I have
$ node -v
v4.4.6
Which at the top of the file you can see should be a later version than IOJS_3_0_MODULE_VERSION
, providing arbitrary length buffers. However, the assert is not surrounded by #ifdef
s. Does anyone know how to use arbitrary length buffers when using nan?