javascript - Do I need the IPFS daemon to upload files from a browser? -


i'm working on project using ipfs , i'm trying create website allows users upload files directly browser ipfs. goal website front-end website whenever add file ipfs , check it's hash on https://gateway.ipfs.io/ipfs/hash-here nothing happens, made me think files not getting uploaded ipfs because i'm not running on local machine. correct?

const buffer = require('safe-buffer').buffer;  export default function uploadfiles(node, files) {      let reader = new filereader();      reader.onloadend = () => {          let bytedata = reader.result.split('base64,')[1];         let filedata = buffer.from(bytedata);          node.files.add(filedata, (err, res) => {              if (err) {                 throw err             }              let hash = res[0].hash             console.log(hash);  ///////prints hash isnt visible on                                  //gateway              node.files.cat(hash, (err, res) => {                 if (err) {                     throw err                 }                 let data = ''                 res.on('data', (d) => {                     data = data + d                 })                 res.on('end', () => {                     // console.log(data);                     // console.log(atob(data));                 })             })          });      }      reader.readasdataurl(files['0']);  }; 

are running js-ipfs node in browser? did chance @ examples in examples folder in js-ipfs repo? url here: https://github.com/ipfs/js-ipfs/tree/master/examples

if add file node , node on, ipfs gateway node able find content browser node.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -