captureFile(event) {
    event.preventDefault()
    //get the first file
    const file = event.target.files[0]
    //get the file reader
    const reader = new window.FileReader()
    //convert file to array that buffer will understand
    reader.readAsArrayBuffer(file)
    reader.onloadend = () => {
      this.setState({ buffer: Buffer(reader.result) })
      console.log('buffer', this.state.buffer)
    }
  }
// conver file into buffer so ipfs-api can read it
conver file into buffer so ipfs-api can read it
conver file into buffer so ipfs - api can read it
captureFile(event) {
    event.preventDefault()
    const file = event.target.files[0]
    const reader = new window.FileReader()
    reader.readAsArrayBuffer(file)
    reader.onloadend = () => {
      this.setState({ buffer: Buffer(reader.result) })
      console.log('buffer', this.state.buffer)
    }
  }
captureFile ( event ) { event . preventDefault ( ) const file = event . target . files [ 0 ] const reader = new window . FileReader ( ) reader . readAsArrayBuffer ( file ) reader . onloadend = ( ) => { this . setState ( { buffer : Buffer ( reader . result ) } ) console . log ( 'buffer' , this . state . buffer ) } }
conver file into buffer so ipfs-api can read it
conver file into buffer so ipfs - api can read it
//get the first file //get the file reader //convert file to array that buffer will understand