How to convert image to base64encoded for creation for TE through postman

Sushmitha
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 6, 2023

Hi All,

I have tried to create test execution through postman with evidence attaching to it. For 'data' element in evidence tag i have converted locally stored image into base64encoded and updated that in data. It worked properly.

But i am using script in prerequisite to convert image into base64encoded , image is uploaded but when i tried to open the uploaded image in Jira TE . Image is not loading .

 

const fs = require('fs');

// Replace this with the actual path to your file
const filePath = 'given locally stored path';

// Read the file as a binary buffer
const fileBuffer = fs.readFileSync(filePath);

// Encode the file content as Base64
const base64Encoded = Buffer.from(fileBuffer).toString('base64');

console.log(base64Encoded);// used this base64Encoded in body script.
Please help me where it went wrong .

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events