diff --git a/README.md b/README.md index 3dd23759..da5c4801 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ -ipfs-unixfs JavaScript Implementation -===================================== +# ipfs-unixfs JavaScript Implementation [![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) +[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) [![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) +[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) [![Build Status](https://travis-ci.org/ipfs/js-ipfs-unixfs.svg?style=flat-square&branch=master)](https://travis-ci.org/ipfs/js-ipfs-unixfs) [![Coverage Status](https://coveralls.io/repos/github/ipfs/js-ipfs-unixfs/badge.svg?branch=master)](https://coveralls.io/github/ipfs/js-ipfs-unixfs?branch=master) [![Dependency Status](https://david-dm.org/ipfs/js-ipfs-unixfs.svg?style=flat-square)](https://david-dm.org/ipfs/js-ipfs-unixfs) @@ -12,21 +13,41 @@ ipfs-unixfs JavaScript Implementation [The unixfs spec can be found inside the ipfs/specs repository](http://github.com/ipfs/specs) -# Installation - -## npm +## Table of Contents + +- [Install](#install) + - [npm](#npm) + - [Use in Node.js](#use-in-nodejs) + - [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler) + - [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag) +- [Usage](#usage) + - [Examples](#examples) + - [Create a file composed by several blocks](#create-a-file-composed-by-several-blocks) + - [Create a directory that contains several files](#create-a-directory-that-contains-several-files) +- [API](#api) + - [unixfs Data Structure](#unixfs-data-structure) + - [create an unixfs Data element](#create-an-unixfs-data-element) + - [add and remove a block size to the block size list](#add-and-remove-a-block-size-to-the-block-size-list) + - [get total fileSize](#get-total-filesize) + - [marshal and unmarshal](#marshal-and-unmarshal) +- [Contribute](#contribute) +- [License](#license) + +## Install + +### npm ```sh > npm i ipfs-unixfs ``` -## Use in Node.js +### Use in Node.js ```JavaScript var Unixfs = require('ipfs-unixfs') ``` -## Use in a browser with browserify, webpack or any other bundler +### Use in a browser with browserify, webpack or any other bundler 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. @@ -34,7 +55,7 @@ The code published to npm that gets loaded on require is in fact a ES5 transpile var Unixfs = require('ipfs-unixfs') ``` -## Use in a browser Using a script tag +### Use in a browser Using a script tag Loading this module through a script tag will make the `Unixfs` obj available in the global namespace. @@ -44,9 +65,9 @@ Loading this module through a script tag will make the `Unixfs` obj available in ``` -# Usage +## Usage -## Examples +### Examples #### Create a file composed by several blocks @@ -120,3 +141,16 @@ data.fileSize() // => size in bytes var marsheled = data.marshal() var unmarsheled = Unixfs.unmarshal(marsheled) ``` + +## Contribute + +Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/js-ipfs-unixfs/issues)! + +This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). + +[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) + +## License + +[MIT](LICENSE) +