How to use the blob-util.createBlob 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 morkro / happy-plants / src / utils / blob.spec.js View on Github external
describe('utils/blob.js', () => {
  const blob = blobUtil.createBlob(['hello world'], { type: 'text/plain' })
  let base64 = null

  beforeAll(async () => {
    base64 = await blobUtil.blobToBase64String(blob)
  })

  it('isBase64() works as expected', () => {
    expect(isBase64(base64)).toEqual(true)
    expect(isBase64()).toEqual(false)
  })

  it('isBlobbable() works as expected', () => {
    expect(isBlobbable(blob)).toEqual(true)
    expect(isBlobbable('foo')).toEqual(false)
  })
github processing / p5.js-web-editor / client / modules / IDE / actions / files.js View on Github external
export function getBlobUrl(file) {
  if (file.blobUrl) {
    blobUtil.revokeObjectURL(file.blobUrl);
  }

  const fileBlob = blobUtil.createBlob([file.content], { type: 'text/plain' });
  const blobURL = blobUtil.createObjectURL(fileBlob);
  return blobURL;
}