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
@@ -78,7 +79,7 @@ for await (const buf of entry.content()) {
78
79
console.info(bytes) // 0, 1, 2, 3
79
80
```
80
81
81
-
####API
82
+
## API
82
83
83
84
```js
84
85
import { exporter } from'ipfs-unixfs-exporter'
@@ -94,7 +95,7 @@ Returns a Promise which resolves to a `UnixFSEntry`.
94
95
95
96
-`signal` ([AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)): Used to cancel any network requests that are initiated as a result of this export
96
97
97
-
####UnixFSEntry
98
+
### UnixFSEntry
98
99
99
100
```javascript
100
101
{
@@ -127,7 +128,7 @@ if (entry.type === 'directory') {
127
128
}
128
129
```
129
130
130
-
#### Raw entries
131
+
### Raw entries
131
132
132
133
Entries with a `raw` codec `CID` return raw entries:
133
134
@@ -151,7 +152,7 @@ for await (const chunk of entry.content()) {
151
152
152
153
Unless you an options object containing `offset` and `length` keys as an argument to `entry.content()`, `chunk` will be equal to `entry.node`.
153
154
154
-
#### CBOR entries
155
+
### CBOR entries
155
156
156
157
Entries with a `dag-cbor` codec `CID` return JavaScript object entries:
157
158
@@ -167,7 +168,7 @@ Entries with a `dag-cbor` codec `CID` return JavaScript object entries:
167
168
168
169
There is no `content` function for a `CBOR` node.
169
170
170
-
#### `entry.content({ offset, length })`
171
+
### `entry.content({ offset, length })`
171
172
172
173
When `entry` is a file or a `raw` node, `offset` and/or `length` arguments can be passed to `entry.content()` to return slices of data:
####Create a directory that contains several files
74
+
### Create a directory that contains several files
87
75
88
76
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
77
90
78
```JavaScript
91
79
constdata=newUnixFS({ type:'directory' })
92
80
```
93
81
94
-
## API
95
-
96
-
#### UnixFS Data Structure
82
+
### UnixFS Data Structure
97
83
98
84
```protobuf
99
85
syntax = "proto2";
@@ -128,7 +114,7 @@ message Metadata {
128
114
}
129
115
```
130
116
131
-
####create an unixfs Data element
117
+
### create an unixfs Data element
132
118
133
119
```JavaScript
134
120
constdata=newUnixFS([options])
@@ -148,7 +134,7 @@ const data = new UnixFS([options])
148
134
- mode (Number, default `0644` for files, `0755` for directories/hamt-sharded-directories) file mode
149
135
- mtime (`Date`, `{ secs, nsecs }`, `{ Seconds, FractionalNanoseconds }`, `[ secs, nsecs ]`): The modification time of this node
150
136
151
-
####add and remove a block size to the block size list
137
+
### add and remove a block size to the block size list
152
138
153
139
```JavaScript
154
140
data.addBlockSize(<size in bytes>)
@@ -158,20 +144,20 @@ data.addBlockSize(<size in bytes>)
0 commit comments