domenic / svg2png

Converts SVGs to PNGs, using PhantomJS
Other
585 stars 134 forks source link

Error at writeBufferInChunks in loop with 4.000 svg files #95

Open leandromatos opened 7 years ago

leandromatos commented 7 years ago

I have a loop with 4.000 svg iles, when trying to convert them to PNG, an error happens.

When I try to do this with fewer images, everything works fine.

Any idea what that might be?

The error is:


TypeError: Cannot read property 'cork' of undefined
    at writeBufferInChunks (/Users/leandromatos/Projects/sparkle-code-cli/node_modules/svg2png/lib/svg2png.js:50:19)
    at Promise.resolve.then (/Users/leandromatos/Projects/sparkle-code-cli/node_modules/svg2png/lib/svg2png.js:15:9)
    at <anonymous>```
leandromatos commented 7 years ago

The same error occurred with 300 svg files.

domenic commented 7 years ago

No idea. Some reproducible demo code/SVGs would be a start, and perhaps your Node.js version as well.

leandromatos commented 7 years ago

I belive that the problem is with Phanton.js. It opens an instance to each SVG of the loop.

The ideal would be to create a way to start the library (which would instantiate Phanton.js) out of the loop, inside of the loop the transformation begin normaly, and at the end of the loop, a way to close the instance of Phantoh.js

I was able to solve using another library that does + - this, see: https://github.com/atronov/svg2png-many