Get the file contents of current activeDocument

I want to update contents on the cloud for the current active document. If the document is not present then i want to create new on cloud for this i need the file buffer or contents on the save event or on a particular UXP plugin action. Is this possible ?