mirror of
https://github.com/NohamR/lanyard-profile-readme.git
synced 2026-05-26 13:16:42 +00:00
base64 working?? also 100th commit :D
This commit is contained in:
22
src/toBase64.ts
Normal file
22
src/toBase64.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
const imageToBase64 = require('image-to-base64');
|
||||
|
||||
const encodeBase64 = async (url: string): Promise<string> => {
|
||||
|
||||
let encoded: string = '';
|
||||
|
||||
await imageToBase64(url)
|
||||
.then(
|
||||
(response: string) => {
|
||||
return encoded = response;
|
||||
}
|
||||
)
|
||||
.catch(
|
||||
(error: any) => {
|
||||
console.log(error);
|
||||
}
|
||||
)
|
||||
|
||||
return encoded;
|
||||
}
|
||||
|
||||
export default encodeBase64;
|
||||
Reference in New Issue
Block a user