@@ -88,154 +88,149 @@ export interface RmOptions extends UnixFsRmOptions {
88
88
*/
89
89
export interface MFS {
90
90
/**
91
- * Add a single `Uint8Array` to your Helia node as a file.
91
+ * Add a single `Uint8Array` to your MFS as a file.
92
92
*
93
93
* @example
94
94
*
95
95
* ```typescript
96
- * const cid = await fs.addBytes(Uint8Array.from([0, 1, 2, 3]))
97
- *
98
- * console.info(cid)
96
+ * await fs.writeBytes(Uint8Array.from([0, 1, 2, 3]), '/foo.txt')
99
97
* ```
100
98
*/
101
99
writeBytes : ( bytes : Uint8Array , path : string , options ?: Partial < WriteOptions > ) => Promise < void >
102
100
103
101
/**
104
- * Add a stream of `Uint8Array` to your Helia node as a file.
102
+ * Add a stream of `Uint8Array` to your MFS as a file.
105
103
*
106
104
* @example
107
105
*
108
106
* ```typescript
109
107
* import fs from 'node:fs'
110
108
*
111
109
* const stream = fs.createReadStream('./foo.txt')
112
- * const cid = await fs.addByteStream(stream)
113
- *
114
- * console.info(cid)
110
+ * await fs.writeByteStream(stream, '/foo.txt')
115
111
* ```
116
112
*/
117
113
writeByteStream : ( bytes : ByteStream , path : string , options ?: Partial < WriteOptions > ) => Promise < void >
118
114
119
115
/**
120
- * Retrieve the contents of a file from your Helia node .
116
+ * Retrieve the contents of a file from your MFS .
121
117
*
122
118
* @example
123
119
*
124
120
* ```typescript
125
- * for await (const buf of fs.cat(cid )) {
121
+ * for await (const buf of fs.cat('/foo.txt' )) {
126
122
* console.info(buf)
127
123
* }
128
124
* ```
129
125
*/
130
126
cat : ( path : string , options ?: Partial < CatOptions > ) => AsyncIterable < Uint8Array >
131
127
132
128
/**
133
- * Change the permissions on a file or directory in a DAG
129
+ * Change the permissions on a file or directory in your MFS
134
130
*
135
131
* @example
136
132
*
137
133
* ```typescript
138
- * const beforeCid = await fs.addBytes (Uint8Array.from([0, 1, 2, 3]))
139
- * const beforeStats = await fs.stat(beforeCid )
134
+ * await fs.writeBytes (Uint8Array.from([0, 1, 2, 3]), '/foo.txt' )
135
+ * const beforeStats = await fs.stat('/foo.txt' )
140
136
*
141
- * const afterCid = await fs.chmod(cid , 0x755)
142
- * const afterStats = await fs.stat(afterCid )
137
+ * await fs.chmod('/foo.txt' , 0x755)
138
+ * const afterStats = await fs.stat('/foo.txt' )
143
139
*
144
- * console.info(beforeCid, beforeStats)
145
- * console.info(afterCid, afterStats)
140
+ * console.info(beforeStats)
141
+ * console.info(afterStats)
146
142
* ```
147
143
*/
148
144
chmod : ( path : string , mode : number , options ?: Partial < ChmodOptions > ) => Promise < void >
149
145
150
146
/**
151
- * Add a file or directory to a target directory.
147
+ * Add a file or directory to a target directory in your MFS .
152
148
*
153
149
* @example
154
150
*
155
151
* ```typescript
156
- * const fileCid = await fs.addBytes(Uint8Array.from([0, 1, 2, 3]))
157
- * const directoryCid = await fs.addDirectory()
152
+ * await fs.writeBytes(Uint8Array.from([0, 1, 2, 3]), '/foo.txt')
153
+ * await fs.mkdir('/bar')
154
+ *
155
+ * await fs.cp('/foo.txt', '/bar')
156
+ * ```
157
+ *
158
+ * Copy a file from one place to another in your MFS.
159
+ *
160
+ * @example
158
161
*
159
- * const updatedCid = await fs.cp(fileCid, directoryCid, 'foo.txt')
162
+ * ```typescript
163
+ * await fs.writeBytes(Uint8Array.from([0, 1, 2, 3]), '/foo.txt')
160
164
*
161
- * console.info(updatedCid )
165
+ * await fs.cp('/foo.txt', '/bar.txt' )
162
166
* ```
163
167
*/
164
168
cp : ( source : CID | string , destination : string , options ?: Partial < CpOptions > ) => Promise < void >
165
169
166
170
/**
167
- * List directory contents.
171
+ * List directory contents from your MFS .
168
172
*
169
173
* @example
170
174
*
171
175
* ```typescript
172
- * for await (const entry of fs.ls(directoryCid )) {
173
- * console.info(etnry )
176
+ * for await (const entry of fs.ls('/bar' )) {
177
+ * console.info(entry )
174
178
* }
175
179
* ```
176
180
*/
177
181
ls : ( path ?: string , options ?: Partial < LsOptions > ) => AsyncIterable < UnixFSEntry >
178
182
179
183
/**
180
- * Make a new directory under an existing directory .
184
+ * Make a new directory in your MFS .
181
185
*
182
186
* @example
183
187
*
184
188
* ```typescript
185
- * const directoryCid = await fs.addDirectory()
186
- *
187
- * const updatedCid = await fs.mkdir(directoryCid, 'new-dir')
188
- *
189
- * console.info(updatedCid)
189
+ * await fs.mkdir('/new-dir')
190
190
* ```
191
191
*/
192
192
mkdir : ( path : string , options ?: Partial < MkdirOptions > ) => Promise < void >
193
193
194
194
/**
195
- * Remove a file or directory from an existing directory .
195
+ * Remove a file or directory from your MFS .
196
196
*
197
197
* @example
198
198
*
199
199
* ```typescript
200
- * const directoryCid = await fs.addDirectory()
201
- * const updatedCid = await fs.mkdir(directoryCid, 'new-dir')
202
- *
203
- * const finalCid = await fs.rm(updatedCid, 'new-dir')
204
- *
205
- * console.info(finalCid)
200
+ * await fs.mkdir('/new-dir')
201
+ * await fs.rm('/new-dir')
206
202
* ```
207
203
*/
208
204
rm : ( path : string , options ?: Partial < RmOptions > ) => Promise < void >
209
205
210
206
/**
211
- * Return statistics about a UnixFS DAG.
207
+ * Return statistics about a UnixFS DAG in your MFS .
212
208
*
213
209
* @example
214
210
*
215
211
* ```typescript
216
- * const fileCid = await fs.addBytes(Uint8Array.from([0, 1, 2, 3]))
217
- *
218
- * const stats = await fs.stat(fileCid)
212
+ * await fs.writeBytes(Uint8Array.from([0, 1, 2, 3]), '/foo.txt')
219
213
*
214
+ * const stats = await fs.stat('/foo.txt')
220
215
* console.info(stats)
221
216
* ```
222
217
*/
223
218
stat : ( path : string , options ?: Partial < StatOptions > ) => Promise < UnixFSStats >
224
219
225
220
/**
226
- * Update the mtime of a UnixFS DAG
221
+ * Update the mtime of a UnixFS DAG in your MFS.
227
222
*
228
223
* @example
229
224
*
230
225
* ```typescript
231
- * const beforeCid = await fs.addBytes (Uint8Array.from([0, 1, 2, 3]))
232
- * const beforeStats = await fs.stat(beforeCid )
226
+ * await fs.writeBytes (Uint8Array.from([0, 1, 2, 3]), '/foo.txt' )
227
+ * const beforeStats = await fs.stat('/foo.txt' )
233
228
*
234
- * const afterCid = await fs.touch(beforeCid )
229
+ * await fs.touch('/foo.txt' )
235
230
* const afterStats = await fs.stat(afterCid)
236
231
*
237
- * console.info(beforeCid, beforeStats)
238
- * console.info(afterCid, afterStats)
232
+ * console.info(beforeStats)
233
+ * console.info(afterStats)
239
234
* ```
240
235
*/
241
236
touch : ( path : string , options ?: Partial < TouchOptions > ) => Promise < void >
0 commit comments