golang-design / clipboard

📋 cross-platform clipboard package that supports accessing text and image in Go (macOS/Linux/Windows/Android/iOS)
https://golang.design/x/clipboard
MIT License
579 stars 64 forks source link

Feature Request: Support to read and write raw content (without any formatting) from and into clipboards #40

Open rams3sh opened 1 year ago

rams3sh commented 1 year ago

Hey

First of all thanks a ton for this project. I have been experimenting with the project for a week now. I have a requirement for an internal project where I have to detect the content type of the clipboard as file or text and take an action based on that.

I tried the clipboard package and when I try to copy a folder or a file (agnostic of any format) , the Read function gives only the text path of the folder. Hence I am unable to differentiate if the copied content is just the text file path or the actual file itself.

My request pertains to providing an additional method to directly read the raw content from the clipboard (hex format / any other suitable binary format) , than forcing it to be formatted to a Text or Image (which is the case as on date) in which case it loses context of the content; and a direct write of raw content to the clipboard.

This will also help others to write their own implementation of formatting until the support for their requested format ( such as the issue here - https://github.com/golang-design/clipboard/issues/17) is added to the main library.