How to use the blob-util.base64StringToBlob 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 willyb321 / media_mate / app / renderjs / viewer.js View on Github external
convertImgToBlob(`https://www.thetvdb.com/banners/${res.filename}`).then(blob => {
								db.insert({
									_id: `img${tvelem.show.replace(' ', '')}S${tvelem.season}E${tvelem.episode}`,
									elempath: data[2],
									elem: data[0],
									tvelem: data[1],
									imgData: blob
								});
								blobUtil.base64StringToBlob(blob, 'image/jpeg').then(blob => {
									console.info(blob);
									img.children[0].style.backgroundImage = `url(${URL.createObjectURL(blob)})`; // eslint-disable-line
								}).catch(err => {
									Raven.captureException(err);
									Raven.showReportDialog();
								});
							});
						} else if (res.filename === '') {
github willyb321 / media_mate / app / renderjs / viewer.js View on Github external
db.find({_id: `img${tvelem.show.replace(' ', '')}S${tvelem.season}E${tvelem.episode}`}, (err, doc) => {
							if (err) {
								Raven.captureException(err);
								Raven.showReportDialog();
							}
							blobUtil.base64StringToBlob(doc[0].imgData, 'image/jpeg').then(blob => {
								img.children[0].style.backgroundImage = `url(${URL.createObjectURL(blob)})`; // eslint-disable-line
								resolve(['got from db']);
							}).catch(err => {
								Raven.captureException(err);
								Raven.showReportDialog();
							});
						});
					}
github morkro / happy-plants / src / utils / blob.spec.js View on Github external
it('convertToBlob() works as expected', async () => {
    const config = { blob: base64 }
    expect(await convertToBlob(config)).toEqual({
      blob: await blobUtil.base64StringToBlob(config.blob)
    })
    expect(convertToBlob({})).toEqual({})
  })
})
github morkro / happy-plants / src / utils / blob.js View on Github external
export function convertToBlob (config) {
  if (isBlobbable(config.blob) || !isBase64(config.blob)) {
    return config
  }

  return Object.assign({}, config, {
    blob: blobUtil.base64StringToBlob(config.blob)
  })
}
github agalwood / Motrix / src / renderer / components / Command / index.js View on Github external
function showAddBtTaskWithFile (fileName, base64Data = '') {
  const blob = base64StringToBlob(base64Data, 'application/x-bittorrent')
  const file = new File([blob], fileName, { type: 'application/x-bittorrent' })
  const fileList = buildFileList(file)
  store.dispatch('app/showAddTaskDialog', 'torrent')
  setTimeout(() => {
    store.dispatch('app/addTaskAddTorrents', { fileList })
  }, 200)
}
github hugetiny / negibox / src / components / Command / index.js View on Github external
function showAddBtTaskWithFile (fileName, base64Data = '') {
  const blob = base64StringToBlob(base64Data, 'application/x-bittorrent')
  const file = new File([blob], fileName, { type: 'application/x-bittorrent' })
  const fileList = buildFileList(file)
  store.dispatch('app/showAddTaskDialog', 'torrent')
  setTimeout(() => {
    store.dispatch('app/addTaskAddTorrents', { fileList })
  }, 200)
}