node-rsvg
node-rsvg copied to clipboard
write after end
Using the example code of the repo + the starting setup of express-js i'm running into an error where the first request works but the request after that returns the following error:
Error: write after end
at writeAfterEnd (_stream_writable.js:159:12)
at Rsvg.Writable.write (_stream_writable.js:204:5)
at Readable.ondata (_stream_readable.js:529:20)
at emitOne (events.js:90:13)
at Readable.emit (events.js:182:7)
at Readable.read (_stream_readable.js:361:10)
at flow (_stream_readable.js:744:26)
at emitReadable_ (_stream_readable.js:413:3)
at nextTickCallbackWith1Arg (node.js:464:9)
at process._tickCallback (node.js:386:17)
Code used for the express route:
app.post('/create', function(req, res) {
var s = new stream.Readable();
s._read = function noop() {};
s.push(JSON.parse(req.body.svg));
s.push(null)
s.pipe(svg)
res.end()
});
Cheers!