You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> JavaScript implementation of IPFS' unixfs (a Unix FileSystem files representation on top of a MerkleDAG)
13
+
> JavaScript implementation of IPFS' UnixFS (a Unix FileSystem files representation on top of a MerkleDAG)
14
14
15
-
[The unixfs spec can be found inside the ipfs/specs repository](http://github.com/ipfs/specs)
15
+
The UnixFS spec can be found inside the [ipfs/specs repository](http://github.com/ipfs/specs)
16
16
17
17
## Lead Maintainer <!-- omit in toc -->
18
18
@@ -30,11 +30,12 @@
30
30
-[Create a file composed by several blocks](#create-a-file-composed-by-several-blocks)
31
31
-[Create a directory that contains several files](#create-a-directory-that-contains-several-files)
32
32
-[API](#api)
33
-
-[unixfs Data Structure](#unixfs-data-structure)
33
+
-[UnixFS Data Structure](#unixfs-data-structure)
34
34
-[create an unixfs Data element](#create-an-unixfs-data-element)
35
35
-[add and remove a block size to the block size list](#add-and-remove-a-block-size-to-the-block-size-list)
36
36
-[get total fileSize](#get-total-filesize)
37
37
-[marshal and unmarshal](#marshal-and-unmarshal)
38
+
-[is this UnixFS entry a directory?](#is-this-unixfs-entry-a-directory)
38
39
-[Contribute](#contribute)
39
40
-[License](#license)
40
41
@@ -49,20 +50,20 @@
49
50
### Use in Node.js
50
51
51
52
```JavaScript
52
-
varUnixfs=require('ipfs-unixfs')
53
+
varUnixFS=require('ipfs-unixfs')
53
54
```
54
55
55
56
### Use in a browser with browserify, webpack or any other bundler
56
57
57
58
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.
58
59
59
60
```JavaScript
60
-
varUnixfs=require('ipfs-unixfs')
61
+
varUnixFS=require('ipfs-unixfs')
61
62
```
62
63
63
64
### Use in a browser Using a script tag
64
65
65
-
Loading this module through a script tag will make the `Unixfs` obj available in the global namespace.
66
+
Loading this module through a script tag will make the `UnixFS` obj available in the global namespace.
@@ -77,7 +78,7 @@ Loading this module through a script tag will make the `Unixfs` obj available in
77
78
#### Create a file composed by several blocks
78
79
79
80
```JavaScript
80
-
constdata=newUnixfs({ type:'file' })
81
+
constdata=newUnixFS({ type:'file' })
81
82
data.addBlockSize(256) // add the size of each block
82
83
data.addBlockSize(256)
83
84
// ...
@@ -88,12 +89,12 @@ data.addBlockSize(256)
88
89
Creating a directory that contains several files is achieve by creating a unixfs element that identifies a MerkleDAG node as a directory. The links of that MerkleDAG node are the files that are contained in this directory.
89
90
90
91
```JavaScript
91
-
constdata=newUnixfs({ type:'directory' })
92
+
constdata=newUnixFS({ type:'directory' })
92
93
```
93
94
94
95
## API
95
96
96
-
#### unixfs Data Structure
97
+
#### UnixFS Data Structure
97
98
98
99
```protobuf
99
100
syntax = "proto2";
@@ -119,7 +120,7 @@ message Data {
119
120
}
120
121
121
122
message Metadata {
122
-
required string MimeType = 1;
123
+
optional string MimeType = 1;
123
124
}
124
125
```
125
126
@@ -131,7 +132,7 @@ const data = new UnixFS([options])
131
132
132
133
`options` is an optional object argument that might include the following keys:
133
134
134
-
- type (string, default `file`): The type of UnixFS node. Can be:
135
+
- type (string, default `file`): The type of UnixFS entry. Can be:
0 commit comments