js-ipfs | IPFS implementation in JavaScript | Storage library
kandi X-RAY | js-ipfs Summary
kandi X-RAY | js-ipfs Summary
Upgrading from <=0.40 to 0.48? See the release notes for the list of API changes and the migration guide. We've come a long way, but this project is still in Alpha, lots of development is happening, APIs might change, beware of ..
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- write metadata to file
js-ipfs Key Features
js-ipfs Examples and Code Snippets
Community Discussions
Trending Discussions on js-ipfs
QUESTION
I am working on a project with JS implementation of IPFS. I want to upload multiple websites. While going through the official documentation of IPFS Core APIs, under example section of ipfs.name.publish I found a line which says "If you want to have multiple websites (for example) under the same IPFS module, you can always check the key API."
I went through the key API but did not understand the purpose of these APIs, what is there usage and how will it help in hosting multiple websites?
...ANSWER
Answered 2022-Feb-22 at 21:05With ipfs.name.publish
you use the IPNS feature, that maps an identifier (of the form /ipns/...
) to a CID. The API allows to update the mapping, such that your IPNS name always points to the latest version of your content/website. As I've detailed here, the IPNS identifier of the form /ipns/...
is an encoded version of your public key. Only you, who has the corresponding private key can update the mapping of IPNS to CID.
If you want to manage multiple websites, each with a separate IPNS identifier, you need multiple private-public-key-pairs. With the key API, you can manage and create additional keys. When you call ipfs.name.publish()
you can pass the name of a key as an optional argument. This choice which key you use will define the IPNS identifier and also which mapping/website will be updated.
QUESTION
I am using IPFS and IPNS to populate my website with data. Pulling json files via HTTP works great, but when I try to pull .jpg file from my IPNS published IPFS directory, I get an error.
...ANSWER
Answered 2021-May-24 at 17:56easy one to answer you have a typo instead of 'pictures' you have 'picutres' as the error message says.
no link named "picutres"
basically this error message tells you that no folder with that name exists. You should check spelling.
QUESTION
The documentation shows the request to be in the following format:
curl -X POST "https://ipfs.infura.io:5001/api/v0/pin/add?arg=&progress="
I'm currently using JavaScript's API ipfs-http-client to make Http calls.
The add
function from the source code doesn't seem to provide a way to indicate pinning:
ANSWER
Answered 2021-Mar-16 at 22:02I have never used infura and I do not really understand how their authentication supposed to work (linked page does not provide much detail). But assuming that it works via auth token it would be something along these lines:
QUESTION
I'm trying to Spawn an IPFS daemon from the Browser using the provided remote endpoint using the ipfsd-ctl library.
...ANSWER
Answered 2021-Feb-18 at 14:19Ctl.createServer starts an HTTP Server that Ctl.createFactory will connect to. As the warning says "Server not implemented in the browser", you need to run it in nodejs and from the browser use Ctl.createFactory to interact with it.
QUESTION
I am working on a browser application which uses js-ipfs. After I publish an ipfs address (e.g. /ipfs/Qm...), I successfully get the returned name (i.e. /ipns/Qm..). But the problem is that I can't resolve it anywhere else (local node's gateway, public gateway etc.), but within the same browser application, which is very problematic...
How can this be solved? I believe it has something to do with DHT not being supported within browser, but have no idea how to solve it whatsoever...
...ANSWER
Answered 2020-Nov-27 at 17:25Your node needs to be dialable by other nodes for them to be able to resolve content or IPNS names, etc from you. For the browser this means using a WebRTC transport and connecting to a WebRTC signalling server. Other nodes connected to the same signalling server will be able to dial your node.
See the browser-exchange-files example for how two browser nodes can discover each other via a WebRTC signalling server.
The public gateways run go-IPFS which doesn't have a WebRTC transport yet so they can't dial your node to resolve the name.
If you want your IPNS name to be resolvable after the user closes their browser you'll need to ensure it's being propagated on the network somewhere, either by standing up a long-lived go-IPFS node yourself which you control via it's HTTP API (do consider the security implications here) or using a pinning service that will let you create IPNS names.
QUESTION
I'm trying to connect a browser js-ipfs
node to a my NodeJS server that is running an js-ipfs
node as well. I understand that I need to add in the server's Multiaddr
to the browser's bootstrap config in order to connect the two nodes.
However, since my website uses HTTPS
, when I try to connect the browser to my server via ws
it gives this warning: An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.
but from my understanding NodeJS's js-ipfs
cannot listen to wss
calls.
So how can I go about connecting the two nodes? Is using WebSockets the only or best way?
...ANSWER
Answered 2020-Nov-06 at 20:10Due to browser’s security policies you cannot establish unencrypted connection from secure context (e.g. page loaded via HTTPS). You can read about it at MDN Secure Context. So you should make your server to use SSL and then replace ws:// with wss://. The simplest thing to do would be to setup SSL with nginx. You’ll need to setup a domain name for the cert too. You can also look on some documentation on how to setup libp2p/IPFS with SSL on this PR.
You can also use webrtc-star
instead of websockets. However, while you can use both, each one of them have particularities that are better for certain scenarios. If you need peer discovery, webrtc-star
should be used at the moment and you can check https://github.com/libp2p/js-libp2p/tree/master/examples/libp2p-in-the-browser and https://github.com/ipfs/js-ipfs/tree/master/examples/browser-exchange-files . If you do not need to rely on peer discovery and the other peer is a well known peer you can use bootstrap and connect via websockets.
QUESTION
I'm using this code in the browser. It seems to be connecting to ipfs.io via http?. I'm looking to only connect to DHT webRTC peers. I'm guessing I need to pass some option to Ipfs.create? I see an example of custom libp2p here but the amount of options are overwhelming. https://github.com/ipfs/js-ipfs/blob/master/examples/custom-libp2p/index.js
...ANSWER
Answered 2020-Sep-02 at 09:57You can pass the IPFS config options when creating the instance, which enables you to specify the remote WebRTC addresses you want to listen on, and remove/change the Bootstrap nodes to initially connect to. You can see this in the file exchange example at https://github.com/ipfs/js-ipfs/blob/ipfs%400.49.1/examples/browser-exchange-files/public/app.js#L48. So your config might look like this:
QUESTION
I have been working on js-ipfs (0.49.0) and this was working fine but I started getting some issues, anyway I have finally come back to look at the code again and the connection works fine but when I attempt to upload I get a new error
Object is not async iterable
I am not sure what that means or how to address in my code a lot of the examples are for react and not vue
Any pointers much appiciated.
...ANSWER
Answered 2020-Aug-12 at 15:56ipfs.add
returns a single object since ipfs@0.48.0
- you need to change:
QUESTION
The only answers I can find in my research cover uploading multiple files from a directory on a PC. That is not what I'm trying to do. I'm trying to create a directory in ipfs and then add new files to that directory using js-ipfs with pure javascript only, generally one file at a time.
I conceptually understand that a directory in ipfs is simply another file. But I don't understand how to create that directory (file) and add other files to it for later retrieval, particularly with js-ipfs and pure javascript code.
I am implicitly not using node.js, therefore neither react, angular or vue either.
This works for a single file with no directory on ipfs:
...ANSWER
Answered 2020-Jun-30 at 13:32Reading through the js-ipfs documentation, I finally found the answer.
To only create a directory:
QUESTION
I am following an IPFS github example to save to IPFS:
...ANSWER
Answered 2020-Feb-26 at 21:24By default Node.js works with Buffers where use APIs who can be streams, if you works with strings in JavaScript, these works in unicode (utf-8) and these can broke with binary data (for example, an image, a video file, etc).
An easy example to difference strings from Buffers could be compare the size of UTF-8 string, as unicode text (counting by character) and a buffer (counting by byte):
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install js-ipfs
Ensure CORS is correctly configured for use with the HTTP client
Look into the examples to learn how to spawn an IPFS node in Node.js and in the Browser
Consult the Core API docs to see what you can do with an IPFS node
Head over to https://proto.school to take the IPFS course that covers core IPFS concepts and JS APIs
Check out https://docs.ipfs.io for glossary, tips, how-tos and more
See https://blog.ipfs.io for news and more
Need help? Please ask 'How do I?' questions on https://discuss.ipfs.io
Installing ipfs globally will give you the jsipfs command which you can use to start a daemon running:.
If you do not need to run a command line daemon, use the ipfs-core package - it has all the features of ipfs but in a lighter package:.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page