kevva / to-ico

Convert PNG to ICO in memory
MIT License
137 stars 19 forks source link

Buffer.alloc compatibility #15

Closed kylekatarnls closed 7 years ago

kylekatarnls commented 7 years ago

Hi,

I just downloaded to-ico but the last version included Buffer.alloc that is not compatible with the node version 4 you're supposed to support according to your package.json.

Please consider revert this modification to keep backward compatibility (pull request #14).

Thanks,

SamVerschueren commented 7 years ago

Buffer.alloc was backported to v4.

https://nodejs.org/dist/latest-v4.x/docs/api/buffer.html#buffer_class_method_buffer_alloc_size_fill_encoding

kylekatarnls commented 7 years ago

Our project is locked in 4.4.5 right now and so I get Buffer.alloc is undefined

kylekatarnls commented 7 years ago

Hi, for quick fix, this can be done before requiring to-ico:

Buffer.alloc || (Buffer.alloc = function (size, fill, encoding) {
    return new Buffer(size, fill, encoding);
})

But even if you don't plan to fix 4.0 to 4.4 compatibility, maybe you should update package.json to match requirements. And so if backward compability break, it should not be a patch number version increment, it should be new major version according to http://semver.org/ or at least minor.

kylekatarnls commented 7 years ago

Hi, did you reconsider the question?

kevva commented 7 years ago

Fixed in https://github.com/kevva/to-ico/commit/8318a24346d9e4f650665810b60d965c5fada5a5.