How to create an attachment from a filesystem

Hello,

I wonder if you can share some code to create a JIRA attachment from a filesystem in a postfunction.

The idea is that when you create an issue, it reads the content from a given file in the filesystem and creates an attachment in the new issue.

Thanks in advance,