Closed sdumetz closed 8 years ago
I don't see any reason for PNG.load() to be synchronous. I understand it can be a desired behavior but why not make something like :
PNG.load()
PNG.load = function(path,callback) { var file; if(!callback){ file = fs.readFileSync(path); return new PNG(file); }else{ file = fs.readFile(path,function(err,file){ if(err) callback(err); return callback(null,new PNG(file)); }); } };
Of course it's an improvisation and there may be cleaner ways to achieve it, but I think the core idea is useful.
My use case is : I'm only interested in text tags so PNG.decode is a no-go, but I still want async operations.
PNG.decode
Please use png-stream instead. It's better in almost every way.
I don't see any reason for
PNG.load()
to be synchronous. I understand it can be a desired behavior but why not make something like :Of course it's an improvisation and there may be cleaner ways to achieve it, but I think the core idea is useful.
My use case is : I'm only interested in text tags so
PNG.decode
is a no-go, but I still want async operations.