The problem is, this npm package Inkscape works with streams, so I should somehow pipe Inkscape output and write back to gulp file.contents.

This seems to not work because the conversion of this Inkscape stream output to a buffer is async, so it's not work in sync with gulp task flow.

The error I'm receiving is:

stream.js:59
dest.end();
^

TypeError: dest.end is not a function
at Inkscape.onend (stream.js:59:10)
at emitNone (events.js:91:20)
at Inkscape.emit (events.js:185:7)
at Inkscape.<anonymous> (node_modules\inkscape\lib\Inkscape.js:161:26)
at emitNone (events.js:91:20)
at ReadStream.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:926:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)