Skip to content

Commit c55373e

Browse files
Merge pull request #66 from ipfs/feature/standardize-readme
Standardize README
2 parents c11033c + 7212316 commit c55373e

File tree

1 file changed

+74
-40
lines changed

1 file changed

+74
-40
lines changed

README.md

Lines changed: 74 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,44 @@
1-
IPFS Repo JavaScript Implementation
2-
===================================
3-
4-
> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript
1+
# IPFS Repo JavaScript Implementation
52

63
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
74
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
85
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
6+
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
97
[![Build Status](https://travis-ci.org/ipfs/js-ipfs-repo.svg)](https://travis-ci.org/ipfs/js-ipfs-repo)
108
[![Coverage Status](https://coveralls.io/repos/github/ipfs/js-ipfs-repo/badge.svg?branch=master)](https://coveralls.io/github/ipfs/js-ipfs-repo?branch=master) [![Dependency Status](https://david-dm.org/diasdavid/js-peer-id.svg?style=flat-square)](https://david-dm.org/ipfs/js-ipfs-repo)
119
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
1210

13-
## Description
11+
> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript
1412
1513
This is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.
1614

17-
## Architecture
15+
## Table of Contents
16+
17+
- [Background](#background)
18+
- [Good to know (historical context)](#good-to-know-historical-context)
19+
- [Install](#install)
20+
- [npm](#npm)
21+
- [Use in Node.js](#use-in-nodejs)
22+
- [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)
23+
- [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)
24+
- [Usage](#usage)
25+
- [API](#api)
26+
- [var repo = new IPFSRepo(path, opts)](#var-repo--new-ipfsrepopath-opts)
27+
- [repo.exists(cb)](#repoexistscb)
28+
- [repo.version.get(cb(err, version))](#repoversiongetcberr-version)
29+
- [repo.version.set(version, cb(err))](#repoversionsetversion-cberr)
30+
- [repo.config.get(cb(err, config))](#repoconfiggetcberr-config)
31+
- [repo.config.set(config, cb(err))](#repoconfigsetconfig-cberr)
32+
- [repo.keys](#repokeys)
33+
- [repo.datastore.read(key, cb(err, buffer))](#repodatastorereadkey-cberr-buffer)
34+
- [repo.datastore.write(buffer, cb(err, buffer))](#repodatastorewritebuffer-cberr-buffer)
35+
- [repo.datastoreLegacy](#repodatastorelegacy)
36+
- [Contribute](#contribute)
37+
- [License](#license)
38+
39+
## Background
40+
41+
Here is the architectural reasoning for this repo:
1842

1943
```bash
2044
┌─────────────────────────────────┐
@@ -48,13 +72,47 @@ more. Each of the individual repos has an interface defined by
4872
enables us to make IPFS Repo portable (running on Node.js vs the browser) and
4973
accept different types of storage mechanisms for each repo (fs, levelDB, etc).
5074

51-
## Good to know (historical context)
75+
### Good to know (historical context)
5276

5377
- The datastore folder holds the legacy version of datastore, still built in levelDB, there is a current endeavour of pushing it to fs completely.
5478
- The blocks folder is the current version of datastore.
5579
- The keys repo doesn't exist yet, as the private key is simply stored inside config
5680

57-
# Example
81+
## Install
82+
83+
### npm
84+
85+
```sh
86+
> npm i ipfs-repo
87+
```
88+
89+
### Use in Node.js
90+
91+
```JavaScript
92+
var IPFSRepo = require('ipfs-repo')
93+
```
94+
95+
### Use in a browser with browserify, webpack or any other bundler
96+
97+
The code published to npm that gets loaded on require is in fact a ES5 transpiled version with the right shims added. This means that you can require it and use with your favourite bundler without having to adjust asset management process.
98+
99+
```JavaScript
100+
var IPFSRepo = require('ipfs-repo')
101+
```
102+
103+
### Use in a browser Using a script tag
104+
105+
Loading this module through a script tag will make the `Unixfs` obj available in the global namespace.
106+
107+
```html
108+
<script src="https://npmcdn.com/ipfs-repo/dist/index.min.js"></script>
109+
<!-- OR -->
110+
<script src="https://npmcdn.com/ipfs-repo/dist/index.js"></script>
111+
```
112+
113+
## Usage
114+
115+
Example:
58116

59117
```js
60118
var fsBlobStore = require('fs-blob-store') // an in-memory blob store
@@ -124,42 +182,18 @@ Read and write buffers to/from the repo's block store.
124182

125183
**WIP**
126184

127-
# Installation
128-
129-
## npm
130-
131-
```sh
132-
> npm i ipfs-repo
133-
```
134-
135-
## Use in Node.js
136-
137-
```JavaScript
138-
var IPFSRepo = require('ipfs-repo')
139-
```
140-
141-
## Use in a browser with browserify, webpack or any other bundler
142-
143-
The code published to npm that gets loaded on require is in fact a ES5 transpiled version with the right shims added. This means that you can require it and use with your favourite bundler without having to adjust asset management process.
144-
145-
```JavaScript
146-
var IPFSRepo = require('ipfs-repo')
147-
```
148-
149-
## Use in a browser Using a script tag
150-
151-
Loading this module through a script tag will make the `Unixfs` obj available in the global namespace.
152-
153-
```html
154-
<script src="https://npmcdn.com/ipfs-repo/dist/index.min.js"></script>
155-
<!-- OR -->
156-
<script src="https://npmcdn.com/ipfs-repo/dist/index.js"></script>
157-
```
158-
159185
## Contribute
160186

161187
There are some ways you can make this module better:
162188

163189
- Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them
164190
- Help our tests reach 100% coverage!
165191

192+
This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
193+
194+
[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)
195+
196+
## License
197+
198+
[MIT](LICENSE)
199+

0 commit comments

Comments
 (0)