0

我正在尝试运行下面的代码。当我使用 node 命令运行时,它运行完美。

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)
  })
])

但是,当我通过 browserify 运行它并将其添加到我的网站时,我从脚本中收到此错误。

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

我不确定这意味着什么或如何解决它。有人可以帮忙吗?

4

1 回答 1

0

这是一条 safari 消息,表示您正在写入的内容已用完空间

通常出现在 iOS 上

出现的一种奇怪情况是本地存储根本不可用(例如,在私有浏览器会话中)

我怀疑这反映了缺乏 ipfs 试图写入的任何内容,但没有更多上下文,这是一个猜测

于 2018-04-20T03:10:56.410 回答