I'd like to convert an image from .svg to .png. sharp looks like a good choice and will do what I need, when called as:
sharp('input.svg').png().toFile('output.png');
Unfortunately, sharp's file interaction is completely asynchronous and does not fit into my completely synchronous environment at all. In other words, .toFile will write the file asynchronously and return a Promise. But my script needs output.png to be available in the next statement so it can be read and transformed further. I do not want to redesign my whole application only because this minor piece is asynchronous.
Is there a way to force the function into synchronous mode? I've looked at sync-rpc, but I cannot wrap my head around how I would employ it to cover this case.