js-ipfs
js-ipfs copied to clipboard
IPFS implementation in JavaScript
trafficstars
The JavaScript implementation of the IPFS protocol
Getting started
- Read the docs
- 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
- Need help? Please ask 'How do I?' questions on https://discuss.ipfs.io
- Find out about chat channels, the IPFS newsletter, the IPFS blog, and more in the IPFS community space.
Table of Contents
- Getting started
- Install as a CLI user
- Install as an application developer
- Documentation
- Structure
- Packages
- Want to hack on IPFS?
- License
Getting Started
Install as a CLI user
Installing ipfs globally will give you the jsipfs command which you can use to start a daemon running:
$ npm install -g ipfs
$ jsipfs daemon
Initializing IPFS daemon...
js-ipfs version: x.x.x
System version: x64/darwin
Node.js version: x.x.x
Swarm listening on /ip4/127.0
.... more output
You can then add a file:
$ jsipfs add ./hello-world.txt
added QmXXY5ZxbtuYj6DnfApLiGstzPN7fvSyigrRee3hDWPCaf hello-world.txt
Install as an application developer
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:
$ npm install ipfs-core
Then start a node in your app:
import * as IPFS from 'ipfs-core'
const ipfs = await IPFS.create()
const { cid } = await ipfs.add('Hello world')
console.info(cid)
// QmXXY5ZxbtuYj6DnfApLiGstzPN7fvSyigrRee3hDWPCaf
Documentation
Structure
This project is broken into several modules, their purposes are:
/packages/interface-ipfs-coreTests to ensure adherence of an implementation to the spec/packages/ipfsAn aggregator module that bundles the core implementation, the CLI, HTTP API server and daemon/packages/ipfs-cliA CLI to the core implementation/packages/ipfs-coreThe core implementation/packages/ipfs-core-typesTypescript definitions for the core API/packages/ipfs-core-utilsHelpers and utilities common to core and the HTTP RPC API client/packages/ipfs-daemonRun js-IPFS as a background daemon/packages/ipfs-grpc-clientA gRPC client for js-IPFS/packages/ipfs-grpc-protocolShared module between the gRPC client and server/packages/ipfs-grpc-serverA gRPC-over-websockets server for js-IPFS/packages/ipfs-http-clientA client for the RPC-over-HTTP API presented by both js-ipfs and go-ipfs/packages/ipfs-http-serverJS implementation of the Kubo RPC HTTP API/packages/ipfs-http-gatewayJS implementation of the IPFS HTTP Gateway/packages/ipfs-http-responseCreates a HTTP response for a given IPFS Path/packages/ipfs-message-port-clientA client for the RPC-over-message-port API presented by js-ipfs running in a shared worker/packages/ipfs-message-port-protocolCode shared by the message port client & server/packages/ipfs-message-port-serverThe server that receives requests from ipfs-message-port-client
Packages
List of the main packages that make up the IPFS ecosystem.
This table is generated using the module
package-tablewithpackage-table --data=package-list.json.
Want to hack on IPFS?
The IPFS implementation in JavaScript needs your help! There are a few things you can do right now to help out:
Read the Code of Conduct and JavaScript Contributing Guidelines.
- Check out existing issues The issue list has many that are marked as 'help wanted' or 'difficulty:easy' which make great starting points for development, many of which can be tackled with no prior IPFS knowledge
- Look at the IPFS Roadmap This are the high priority items being worked on right now
- Perform code reviews More eyes will help a. speed the project along b. ensure quality, and c. reduce possible future bugs.
- Add tests. There can never be enough tests.
