I want to use this npm package
window = {};
pm.sendRequest(“https://unpkg.com/[email protected]/image-to-base64.min.js”, (error, response) => {
var text = response.text();
(new Function(text))();
window.imageToBase64("https://images.unsplash.com/photo-1611270629569-948d94ca915a?ixid=MXwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyfHx8ZW58MHx8fA%3D%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60")
.then(
(response) => {
console.log(response);
}
)
.catch(
(error) => {
console.log(error);
}
)
});
But this didn’t work and shows me this error ReferenceError: module is not defined
I also tried this code
const imagebase64 = pm.environment.get(“imagebase64”);
(new Function(imagebase64))();
imagebase64("https://images.unsplash.com/photo-1611326758959-07fb4a250fcc?ixid=MXwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyfHx8ZW58MHx8fA%3D%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60")
this is also showing me this error SyntaxError: Unexpected token '}'
Please anyone help me with this