How to use the blob function in blob

To help you get started, we’ve selected a few blob 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 mother / react-files / src / demo.js View on Github external
Object.keys(this.state.files).forEach((key) => {
      const file = this.state.files[key]
      formData.append(key, new Blob([file], { type: file.type }), file.name || 'file')
    })
github grin-pool / grin-pool / grin-js / webui / src / containers / MinerPayment / MinerPayment.js View on Github external
_downloadTxtFile = () => {
    const { minerPaymentTxSlate } = this.props
    const element = document.createElement('a')
    const file = new Blob([minerPaymentTxSlate], { type: 'text/plain' })
    element.href = URL.createObjectURL(file)
    const date = new Date()
    const timestamp = Math.floor(date.getTime() / 1000)
    element.download = `txSlate-${timestamp}.txt`
    element.click()
  }
github Automattic / wp-calypso / client / reader / following-edit / export-button.jsx View on Github external
onFeed( err, data ) {
		this.setState( {
			disabled: false
		} );

		if ( ! err && ! data.success ) {
			err = new Error( this.translate( 'Error exporting Reader feed' ) );
		}

		if ( err ) {
			this.props.onError( err );
		} else {
			const blob = new Blob( [ data.opml ], { type: 'text/xml;charset=utf-8' } );
			saveAs( blob, this.props.saveAs );
			this.props.onExport( this.props.saveAs );
		}
	},

blob

Abstracts out Blob and uses BlobBuilder in cases where it is supported with any vendor prefix.

MIT
Latest version published 4 years ago

Package Health Score

68 / 100
Full package analysis

Popular blob functions