11## Dealing With Blocks
2- The ` ipfs add ` command will create a merkle dag out of the data in the files you
3- specify, it follows the unixfs data format when doing this. what this means, is
2+ The ` ipfs add ` command will create a Merkle DAG out of the data in the files you
3+ specify. It follows the [ unixfs data format] ( https://github.com/ipfs/go-ipfs/blob/master/unixfs/pb/unixfs.proto ) when doing this. This means
44that your files are broken down into blocks, and then arranged in a tree-like
5- structure using 'link nodes' to tie them together. a given files 'hash' is
6- actually the hash of the root (uppermost) node in the dag. for a given dag , you
5+ structure using 'link nodes' to tie them together. A given file's 'hash' is
6+ actually the hash of the root (uppermost) node in the DAG. For a given DAG , you
77can easily view the sub-blocks under it with ` ipfs ls ` .
88
99For example:
@@ -23,33 +23,33 @@ qmrolalcquyo5vu5v8bvqmgjcpzow16wukq3s3vrll2tdk 7866189
2323qmwk51jygpchgwr3srdnmhyerheqd22qw3vvyamb3emhuw 5244129
2424```
2525
26- What this is showing is all of the immediate sub-blocks of your file, and the
27- size of them and their children on disk.
26+ This shows all of the immediate sub-blocks of your file, as well as the
27+ size of them and their children on the disk.
2828
29- ### What to do With Blocks?
30- If you feel adventurous you can get a lot of different information out of these
31- different blocks. you can use the sub-block hashes as input to ` ipfs cat ` to
29+ ### What to do with Blocks?
30+ If you feel adventurous, you can get a lot of different information out of these
31+ different blocks. You can use the sub-block hashes as input to ` ipfs cat ` to
3232see only the data in any given sub-tree (the data of that block and its
33- children). to see just the data of a given block and not its children, use
34- ` ipfs block get ` . but be careful, as ` ipfs block get ` on an intermediate block
35- will print out the raw binary data of its dag structure to your screen.
33+ children). To see just the data of a given block and not its children, use
34+ ` ipfs block get ` . But be careful, as ` ipfs block get ` on an intermediate block
35+ will print out the raw binary data of its DAG structure to your screen.
3636
3737` ipfs block stat ` will tell you the exact size of a given block (without its
3838children), and ` ipfs refs ` will tell you all the children of that block.
39- similarly , ` ipfs ls ` or ` ipfs object links ` will show you all children and
39+ Similarly , ` ipfs ls ` or ` ipfs object links ` will show you all children and
4040their sizes. ` ipfs refs ` is a more suitable command for scripting something
4141to run on each child block of a given object.
4242
4343### Blocks vs Objects
44- In ipfs , a block refers to a single unit of data, identified by its key (hash).
45- a block can be any sort of data, and does not necessarily have any sort of
46- format associated with it. an object, on the other hand, refers to a block that
47- follows the merkledag protobuf data format. it can be parsed and manipulated
48- via the ` ipfs object ` command. any given hash may represent an object or a block.
44+ In IPFS , a block refers to a single unit of data, identified by its key (hash).
45+ A block can be any sort of data, and does not necessarily have any sort of
46+ format associated with it. An object, on the other hand, refers to a block that
47+ follows the Merkle DAG protobuf data format. It can be parsed and manipulated
48+ via the ` ipfs object ` command. Any given hash may represent an object or a block.
4949
50- ### Creating a block from scratch
51- Creating your own blocks is easy! simply put your data in a file and run
52- ` ipfs block put <yourfile> ` on it, or you can pipe your filedata into
50+ ### Creating a Block from scratch
51+ Creating your own blocks is easy! Simply put your data in a file and run
52+ ` ipfs block put <yourfile> ` on it. Or, you can pipe your filedata into
5353` ipfs block put ` , like so:
5454
5555```
@@ -58,8 +58,8 @@ QmfQ5QAjvg4GtA3wg3adpnDJug8ktA1BxurVqBD8rtgVjM
5858$ ipfs block get QmfQ5QAjvg4GtA3wg3adpnDJug8ktA1BxurVqBD8rtgVjM
5959This is some data
6060```
61- Note: When making your own block data, you wont be able to read the data with
62- ` ipfs cat ` , this is because you are inputting raw data without the unixfs data
63- format. To read raw blocks use ` ipfs block get ` as shown in the example.
61+ Note: When making your own block data, you won't be able to read the data with
62+ ` ipfs cat ` . This is because you are inputting raw data without the unixfs data
63+ format. To read raw blocks, use ` ipfs block get ` as shown in the example.
6464
6565By [ whyrusleeping] ( http://github.com/whyrusleeping )
0 commit comments