Downloading data into file

Hi all, I’d like some help -
As part of developing a UI kit app, I’m trying to process data into a document and then download that document into a docx file or xlsx file.
I’ve been able to access content from jira and place it into a buffer array, but then I am not able to turn it into a document or open it. I’ve tried using React.createElement, document.createElement, fs.writeFile, FormData.append and Blob.
All different methods lead to errors saying that either document is not defined, window is not defined or the browser does not support blobs.
Does anyone have any insight or a code snippet they can share?