saveToIpfsWithFilename (files) {
    const file = [...files][0]
    let btfsId
    const fileDetails = {
      path: file.name,
      content: file
    }
    const options = {
      wrapWithDirectory: true,
      progress: (prog) => console.log(`received: ${prog}`),
      "chunker" : "reed-solomon-1-1-262144"
    }
    this.btfs.add(fileDetails, options)
        .then((response) => {
          console.log(response)
          // CID of wrapping directory is returned last
          btfsId = response[response.length - 1].hash
          console.log(btfsId)
          this.setState({ added_file_hash: btfsId })
        }).catch((err) => {
      console.error(err)
    })
  }
// Add file to BTFS and wrap it in a directory to keep the original filename
Add file to BTFS and wrap it in a directory to keep the original filename
Add file to BTFS and wrap it in a directory to keep the original filename
saveToIpfsWithFilename (files) {
    const file = [...files][0]
    let btfsId
    const fileDetails = {
      path: file.name,
      content: file
    }
    const options = {
      wrapWithDirectory: true,
      progress: (prog) => console.log(`received: ${prog}`),
      "chunker" : "reed-solomon-1-1-262144"
    }
    this.btfs.add(fileDetails, options)
        .then((response) => {
          console.log(response)
          btfsId = response[response.length - 1].hash
          console.log(btfsId)
          this.setState({ added_file_hash: btfsId })
        }).catch((err) => {
      console.error(err)
    })
  }
saveToIpfsWithFilename ( files ) { const file = [ ... files ] [ 0 ] let btfsId const fileDetails = { path : file . name , content : file } const options = { wrapWithDirectory : true , progress : ( prog ) => console . log ( ` ${ prog } ` ) , "chunker" : "reed-solomon-1-1-262144" } this . btfs . add ( fileDetails , options ) . then ( ( response ) => { console . log ( response ) btfsId = response [ response . length - 1 ] . hash console . log ( btfsId ) this . setState ( { added_file_hash : btfsId } ) } ) . catch ( ( err ) => { console . error ( err ) } ) }
Add file to BTFS and wrap it in a directory to keep the original filename
Add file to BTFS and wrap it in a directory to keep the original filename
// CID of wrapping directory is returned last