Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

A way which uses 'CDN' type to use js-ipfs in browser doesn't work. #2219

Closed
@hapsody

Description

@hapsody
  • Version: {version: "0.36.4", repo: 7, commit: ""} in chrome browser(75.0.3770.100(official build) (64bit))
  • Platform: Darwin neojuneui-MacBook-Pro-146.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
  • Subsystem: -

Type: Question

Severity: very low

Description:

I've been trying to use js-ipfs functions without a daemon, I don't know if there's a way or not.
I wrote browser-side js code right below. and I share this code and result.

<html>

<!-- loading the human-readable (not minified) version jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.js"></script>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
  $(document).ready(function() {
    ipfs = new window.Ipfs({
      repo: "/"
    })

    ipfs.once('ready', function() {
      ipfs.config.get().then((res) => console.log('node config:', res))
      ipfs.ls('QmZPHFcKBw2N4ja2Gkvt2YbPHRuaWUbKDjuKw5TurRHJ4q').then((res) => console.log(res));
    })

  })
</script>

</html>

result>
스크린샷 2019-07-05 오후 3 54 20

I think it may because of config.Addresses attributes.
so I set some config attributes likt this but I couldn't make it.

"Addresses": {
"API": "/ip4/127.0.0.1/tcp/5001",
"Announce": [],
"Gateway": "/ip4/127.0.0.1/tcp/8080",
"NoAnnounce": [],
"Swarm": [
"/ip4/0.0.0.0/tcp/4001",
"/ip4/127.0.0.1/tcp/4003/ws",
"/ip6/::/tcp/4001"
]
}

'ls' as well as other features like 'get', 'cat' didn't work.

No way to use js-ipfs without local daemon ever?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions