Skip to content

Latest commit

 

History

History
 
 

examples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

js-ipfs Examples and Tutorials

In this folder and on ProtoSchool, you can find a variety of examples to help you get started with js-ipfs, in Node.js and in the Browser. Every example has a specific purpose and some of them incorporate a full tutorial that you can follow through, helping you expand your knowledge about IPFS and the Distributed Web in general.

Let us know if you find any issue or if you want to contribute and add a new tutorial, feel welcome to submit a PR, thank you!

Tutorials

On ProtoSchool

ProtoSchool offers tutorials on decentralized web protocols, through both interactive tutorials and local chapter events. These IPFS tutorials use js-ipfs in the browser:

In this repo

Clone this repo to explore these tutorials on your local machine:

Examples

Understanding the IPFS Stack

In this section, you will find explanations to different pieces of IPFS Architecture and how js-ipfs implements them.

Annotated version

These explanations are still a work in progress

  • Storing and Retrieving blocks (soon™)
  • IPLD (InterPlanetary Linked-Data) (soon™)
  • IPFS Networking - Managing your swarm, libp2p and more (soon™)

Adding new examples

All examples should include a test.js file. The implementation will differ depending on if your example is intended to run under node or the browser.

Browser test.js

All browser examples should either be a whole webapp or a simple demo (e.g. just index.html and index.js files).

Webapp

Webapps must have a package.json that contains either a build or a bundle script. This script should place all assets in a folder named dist, build or public including an index.html file. During testing this will have a web server run over it using http-server.

Simple demo

Simple demos must have an index.html file in the root of the demo folder. This file will be loaded in a browser and tested via a file:// URL.

Browser test.js

Your test.js file should contain a Nightwatch scenario that will be executed. The URL to example will be present in the IPFS_EXAMPLE_TEST_URL environmental variable when the test is run.

Node

Your test.js file should export an async function that sets up your test, runs any assertions, tears down anything set up and throws an error if the test fails.