This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function convertToImages({ file }: { file: string }): Promise<{ name: string; base64: string; path: string }[]> { | |
return new Promise(async (resolve, reject) => { | |
await fetch("https://tools.saasrock.com/api/pdf-to-image?file=" + file) | |
.then(async (response) => { | |
const jsonBody = await response.json(); | |
const images = jsonBody.images as { name: string; base64: string; path: string }[]; | |
resolve(images); | |
}) | |
.catch((e) => { | |
reject(e); | |
}); | |
}); | |
} | |
export default { | |
convertToImages, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment