Skip to content

pngStream End Before File is writen #802

Closed
@pyromanci

Description

@pyromanci

Issue or Feature

I'm currently working on a script that takes the output from a roll20 API wrote and merge the map data down to a single image. This was due to the fact that a couple of my maps are so big that a few of my maps were so large with so many different elements it was crashing a few of my players.

So i wrote this to rebuild the map in a canvas and save it off as a single PNG. The problem is when i do this. I seem to get the 'saved png' message far before the actually file is finished being written.

The Final PNG size in my tests was almost 300MB in size.

Steps to Reproduce

var fs = require('fs')
, out = fs.createWriteStream(__dirname + '/text.png')
, stream = canvas.pngStream();

stream.on('data', function(chunk){
out.write(chunk);
});

stream.on('end', function(){
console.log('saved png');
});

Your Environment

  • Version of node-canvas (e.g. 1.4.0): 1.4.0
  • Environment: Centos 6 Linux 3.10.101-1.el6.elrepo.x86_64 Expose cairo version #1 SMP Wed Mar 16 20:55:27 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions