should have an option for htmlNode return type #186
Closed
paras-verma
started this conversation in
Ideas
Replies: 1 comment
-
The library should work in the browser and in NodeJS. For this reason, dicebear does not offer an option for HTML nodes. But you can easily convert the string to HTML nodes: const avatar = createAvatar(style, options);
const node = new DOMParser().parseFromString(avatar, "text/xml").firstChild; However, I do not recommend this approach. It is not fast and secure. Instead, I would always recommend the const node = document.createElement('img');
node.src = createAvatar(style, { dataUri: true }); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
createAvatar return a string instead of htmlNode and has an option for base64 so why not one for an html nodes too?
Beta Was this translation helpful? Give feedback.
All reactions