How to use the blob-util.blobToDataURL function in blob-util

To help you get started, we’ve selected a few blob-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github WebMemex / freeze-dry / src / common.js View on Github external
export async function stringToDataUrl(string, type='text/plain') {
    // Using self.btoa is faster but fails for unicode strings.
    const blob = new Blob([string], {type})
    const dataUrl = await blobToDataURL(blob)
    return dataUrl
}
github WebMemex / webmemex-extension / src / overview / overview-ui / components / ImgFromPouch.jsx View on Github external
async updateFile() {
        const { doc, attachmentId } = this.props

        let blob
        try {
            blob = await db.getAttachment(doc._id, attachmentId)
        } catch (err) {}

        const dataUrl = blob ? await blobToDataURL(blob) : undefined

        if (this._isMounted) {
            this.setState({ dataUrl })
        }
    }