How can we capture screenShot of figma plugin and send it to s3 bucket

I am new to Figma plugins.
I am trying to capture the screenshot of my plugin and want to convert it an image to store it on s3.
Is there any possible way with JavaScript?