Search code examples
node.jsbrowserifyasync.jsipfs

WriteError/QuotaExceededError Browserify IPFS ASYNC node.js


I am trying to run the code below. when I run with the node command it runs perfectly.

const IPFS = require('ipfs')
const series = require('async/series')

const node = new IPFS()
let fileMultihash

series([
  (cb) => node.on('ready', cb),
  (cb) => node.version((err, version) => {
    if (err) { return cb(err) }
    console.log('Version:', version.version)
    cb()
  }),
  (cb) => node.files.add({
    path: 'hello.txt',
    content: Buffer.from('Hello this is test asi394298')
  }, (err, filesAdded) => {
    if (err) { return cb(err) }

    console.log('\nAdded file:', filesAdded[0].path, filesAdded[0].hash)
    fileMultihash = filesAdded[0].hash
    cb()
  }),
  (cb) => node.files.cat(fileMultihash, (err, data) => {
    if (err) { return cb(err) }

    console.log('\nFile content:')
    process.stdout.write(data)
  })
])

However when I run this through browserify and add it to my website I get this error from the script.

err {type: "WriteError", name: "WriteError", cause: undefined, message: "QuotaExceededError", stack: "WriteError: QuotaExceededError↵    at http://local…rt (http://localhost/papyrcoin/bundle.js:87990:5)"}

I am not sure what this means or how to fix it. Can someone please help?


Solution

  • that's a safari message that says you've run out of space in the thing you're writing to

    that usually comes up on iOS

    one weird situation in which it comes up is when localstorage isn't available at all (by example, in a private browser session)

    i suspect this reflects a lack of whatever ipfs is trying to write to, but without more context it's a guess