Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- only deals with 64bit files and PDF, DOCX type of files.
- TODO: check if arguments is passed into the function
- */
- function createUrlFromBase64(file, type) {
- let FILE_TYPE;
- let BASE = 'base64';
- switch (type) {
- case 'pdf':
- FILE_TYPE = 'data:application/pdf';
- break;
- case 'docx':
- FILE_TYPE = 'data:application/vnd.openxmlformats-officedocument.wordprocessingml.document';
- break;
- default:
- break;
- }
- return `data:application/${FILE_TYPE};${BASE},${file}`
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement