node-base64-image icon indicating copy to clipboard operation
node-base64-image copied to clipboard

[Suggestion] Return metadata

Open rafaell-lycan opened this issue 1 year ago • 0 comments

Hi, I'm using this lib for about 4 months now and the only thing I guess could be improved is a new option param that returns the base64 string + some metadata such as format, maybe its size (width/height), etc.

The format I guess that it's possible to get on the Axios request itself, and the size would be possible to get using something such as probe-image-size.

That's all, cheers.

const response = encode(url, {
    metadata: true, // it could be a better naming fore sure 👍 
})

console.log(response)
/*
 * {
 *     data: <base64>,
 *     format: <jpg, png, etc>,
 *     width: <number>,
 *     height: <number>,
 * }
 */

rafaell-lycan avatar Jul 30 '22 16:07 rafaell-lycan