go-echarts / snapshot-chromedp

⚔️ The extension for render image in go-echarts.
MIT License
13 stars 2 forks source link

Option to return imgContent []byte instead of writing to file #16

Closed jpyen closed 2 months ago

jpyen commented 2 months ago

Planning to raise a PR to add an option to get the chart imgContent for further processing instead of writing it to file.

Any thoughts or concerns?

Koooooo-7 commented 2 months ago

Planning to raise a PR to add an option to get the chart imgContent for further processing instead of writing it to file.

Any thoughts or concerns?

Could you provide the reason/assumption of y we need this?

jpyen commented 2 months ago

For example if you want to write the output to somewhere else other than disk. For example a remote file system or object storage, or if you want to attach it to an email. All those libraries enabling such will require []byte input.

Koooooo-7 commented 2 months ago

For example if you want to write the output to somewhere else other than disk. For example a remote file system or object storage, or if you want to attach it to an email. All those libraries enabling such will require []byte input.

But for what this lib required. It's not a pure operation all in memory. You always need a place/tmp-dir to store the file with a Chrome runtime. There is only a simple extra IO to get what you want. I suppose we don't need make things complicated such as experting the output stream in the lib for now.

Thx for ur suggestion and idea.