Skip to content

Instantly share code, notes, and snippets.

@AlexandroMtzG
Last active February 5, 2023 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexandroMtzG/ac3800b60e768cfc4f6115680715ccf3 to your computer and use it in GitHub Desktop.
Save AlexandroMtzG/ac3800b60e768cfc4f6115680715ccf3 to your computer and use it in GitHub Desktop.
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