@helia/mfs 5.1.0 → 6.0.0-9c67dbd4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +2 -1
- package/dist/index.min.js.map +4 -4
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -278
- package/dist/src/index.js.map +1 -1
- package/dist/src/mfs.d.ts +26 -0
- package/dist/src/mfs.d.ts.map +1 -0
- package/dist/src/mfs.js +279 -0
- package/dist/src/mfs.js.map +1 -0
- package/package.json +19 -26
- package/src/index.ts +6 -372
- package/src/mfs.ts +373 -0
- package/dist/typedoc-urls.json +0 -16
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mfs.js","sourceRoot":"","sources":["../../src/mfs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACxH,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AACzC,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAkB9C,MAAM,OAAO,GAAG;IACG,UAAU,CAAe;IACzB,MAAM,CAAQ;IACvB,IAAI,CAAM;IACD,GAAG,CAAK;IACR,GAAG,CAAQ;IAE5B,YAAa,UAAyB,EAAE,OAAgB,EAAE;QACxD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;QAEtD,iCAAiC;QACjC,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,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|
|
3
|
+
"version": "6.0.0-9c67dbd4",
|
|
4
4
|
"description": "A mutable filesystem powered by Helia",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/ipfs/helia/tree/main/packages/mfs#readme",
|
|
@@ -32,13 +32,6 @@
|
|
|
32
32
|
"import": "./dist/src/index.js"
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
"eslintConfig": {
|
|
36
|
-
"extends": "ipfs",
|
|
37
|
-
"parserOptions": {
|
|
38
|
-
"project": true,
|
|
39
|
-
"sourceType": "module"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
35
|
"scripts": {
|
|
43
36
|
"clean": "aegir clean",
|
|
44
37
|
"lint": "aegir lint",
|
|
@@ -54,27 +47,27 @@
|
|
|
54
47
|
"test:electron-main": "aegir test -t electron-main"
|
|
55
48
|
},
|
|
56
49
|
"dependencies": {
|
|
57
|
-
"@helia/unixfs": "
|
|
58
|
-
"@libp2p/interface": "^
|
|
59
|
-
"
|
|
60
|
-
"interface-
|
|
61
|
-
"
|
|
62
|
-
"ipfs-unixfs": "^
|
|
63
|
-
"ipfs-unixfs-
|
|
64
|
-
"
|
|
65
|
-
"multiformats": "^13.3.1"
|
|
50
|
+
"@helia/unixfs": "6.0.0-9c67dbd4",
|
|
51
|
+
"@libp2p/interface": "^3.0.2",
|
|
52
|
+
"interface-blockstore": "^6.0.1",
|
|
53
|
+
"interface-datastore": "^9.0.2",
|
|
54
|
+
"ipfs-unixfs": "^12.0.0",
|
|
55
|
+
"ipfs-unixfs-exporter": "^14.0.1",
|
|
56
|
+
"ipfs-unixfs-importer": "^16.0.1",
|
|
57
|
+
"multiformats": "^13.4.1"
|
|
66
58
|
},
|
|
67
59
|
"devDependencies": {
|
|
68
|
-
"@ipld/dag-pb": "^4.1.
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
60
|
+
"@ipld/dag-pb": "^4.1.5",
|
|
61
|
+
"@libp2p/logger": "^6.0.5",
|
|
62
|
+
"aegir": "^47.0.22",
|
|
63
|
+
"blockstore-core": "^6.0.2",
|
|
64
|
+
"datastore-core": "^11.0.2",
|
|
72
65
|
"delay": "^6.0.0",
|
|
73
|
-
"it-all": "^3.0.
|
|
74
|
-
"it-drain": "^3.0.
|
|
75
|
-
"it-first": "^3.0.
|
|
76
|
-
"it-last": "^3.0.
|
|
77
|
-
"it-to-buffer": "^4.0.
|
|
66
|
+
"it-all": "^3.0.9",
|
|
67
|
+
"it-drain": "^3.0.10",
|
|
68
|
+
"it-first": "^3.0.9",
|
|
69
|
+
"it-last": "^3.0.9",
|
|
70
|
+
"it-to-buffer": "^4.0.10",
|
|
78
71
|
"uint8arrays": "^5.1.0"
|
|
79
72
|
},
|
|
80
73
|
"sideEffects": false
|
package/src/index.ts
CHANGED
|
@@ -27,26 +27,20 @@
|
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
-
import { unixfs } from '@helia/unixfs'
|
|
31
|
-
import { AlreadyExistsError, DoesNotExistError, InvalidParametersError, NotADirectoryError } from '@helia/unixfs/errors'
|
|
32
|
-
import { logger } from '@libp2p/logger'
|
|
33
|
-
import { Key } from 'interface-datastore'
|
|
34
|
-
import { UnixFS as IPFSUnixFS } from 'ipfs-unixfs'
|
|
35
30
|
import { CID } from 'multiformats/cid'
|
|
36
|
-
import {
|
|
37
|
-
import type { AddOptions, CatOptions, ChmodOptions, CpOptions, LsOptions, MkdirOptions as UnixFsMkdirOptions, RmOptions as UnixFsRmOptions, StatOptions, TouchOptions,
|
|
38
|
-
import type {
|
|
31
|
+
import { MFS as MFSClass } from './mfs.js'
|
|
32
|
+
import type { AddOptions, CatOptions, ChmodOptions, CpOptions, LsOptions, MkdirOptions as UnixFsMkdirOptions, RmOptions as UnixFsRmOptions, StatOptions, TouchOptions, FileStats, DirectoryStats, RawStats, ExtendedStatOptions, ExtendedFileStats, ExtendedDirectoryStats, ExtendedRawStats } from '@helia/unixfs'
|
|
33
|
+
import type { ComponentLogger } from '@libp2p/interface'
|
|
39
34
|
import type { Blockstore } from 'interface-blockstore'
|
|
40
35
|
import type { Datastore } from 'interface-datastore'
|
|
41
36
|
import type { Mtime } from 'ipfs-unixfs'
|
|
42
37
|
import type { UnixFSEntry, UnixFSBasicEntry } from 'ipfs-unixfs-exporter'
|
|
43
38
|
import type { ByteStream } from 'ipfs-unixfs-importer'
|
|
44
39
|
|
|
45
|
-
const log = logger('helia:mfs')
|
|
46
|
-
|
|
47
40
|
export interface MFSComponents {
|
|
48
41
|
blockstore: Blockstore
|
|
49
42
|
datastore: Datastore
|
|
43
|
+
logger: ComponentLogger
|
|
50
44
|
}
|
|
51
45
|
|
|
52
46
|
export interface MFSInit {
|
|
@@ -237,369 +231,9 @@ export interface MFS {
|
|
|
237
231
|
touch(path: string, options?: Partial<TouchOptions>): Promise<void>
|
|
238
232
|
}
|
|
239
233
|
|
|
240
|
-
interface PathEntry {
|
|
241
|
-
cid: CID
|
|
242
|
-
name: string
|
|
243
|
-
unixfs?: IPFSUnixFS
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
interface WalkPathOptions extends AbortOptions {
|
|
247
|
-
createMissingDirectories: boolean
|
|
248
|
-
finalSegmentMustBeDirectory: boolean
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
class DefaultMFS implements MFS {
|
|
252
|
-
private readonly components: MFSComponents
|
|
253
|
-
private readonly unixfs: UnixFS
|
|
254
|
-
private root?: CID
|
|
255
|
-
private readonly key: Key
|
|
256
|
-
|
|
257
|
-
constructor (components: MFSComponents, init: MFSInit = {}) {
|
|
258
|
-
this.components = components
|
|
259
|
-
|
|
260
|
-
// spellchecker:disable-next-line
|
|
261
|
-
this.key = new Key(init.key ?? '/locals/filesroot')
|
|
262
|
-
this.unixfs = unixfs(components)
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
async #getRootCID (): Promise<CID> {
|
|
266
|
-
if (this.root == null) {
|
|
267
|
-
try {
|
|
268
|
-
const buf = await this.components.datastore.get(this.key)
|
|
269
|
-
this.root = CID.decode(buf)
|
|
270
|
-
} catch (err: any) {
|
|
271
|
-
if (err.name !== 'NotFoundError') {
|
|
272
|
-
throw err
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
this.root = await this.unixfs.addDirectory()
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
return this.root
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
async writeBytes (bytes: Uint8Array, path: string, options?: Partial<WriteOptions>): Promise<void> {
|
|
283
|
-
const cid = await this.unixfs.addBytes(bytes, options)
|
|
284
|
-
|
|
285
|
-
await this.cp(cid, path, options)
|
|
286
|
-
|
|
287
|
-
if (options?.mode != null) {
|
|
288
|
-
await this.chmod(path, options.mode, options)
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (options?.mtime != null) {
|
|
292
|
-
await this.touch(path, options)
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
async writeByteStream (bytes: ByteStream, path: string, options?: Partial<WriteOptions>): Promise<void> {
|
|
297
|
-
const cid = await this.unixfs.addByteStream(bytes, options)
|
|
298
|
-
|
|
299
|
-
await this.cp(cid, path, options)
|
|
300
|
-
|
|
301
|
-
if (options?.mode != null) {
|
|
302
|
-
await this.chmod(path, options.mode, options)
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
if (options?.mtime != null) {
|
|
306
|
-
await this.touch(path, options)
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
async * cat (path: string, options: Partial<CatOptions> = {}): AsyncIterable<Uint8Array> {
|
|
311
|
-
const root = await this.#getRootCID()
|
|
312
|
-
const trail = await this.#walkPath(root, path, {
|
|
313
|
-
...options,
|
|
314
|
-
createMissingDirectories: false,
|
|
315
|
-
finalSegmentMustBeDirectory: false
|
|
316
|
-
})
|
|
317
|
-
|
|
318
|
-
yield * this.unixfs.cat(trail[trail.length - 1].cid, options)
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
async chmod (path: string, mode: number, options: Partial<ChmodOptions> = {}): Promise<void> {
|
|
322
|
-
const root = await this.#getRootCID()
|
|
323
|
-
|
|
324
|
-
this.root = await this.unixfs.chmod(root, mode, {
|
|
325
|
-
...options,
|
|
326
|
-
path
|
|
327
|
-
})
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
async cp (source: CID | string, destination: string, options?: Partial<CpOptions>): Promise<void> {
|
|
331
|
-
const root = await this.#getRootCID()
|
|
332
|
-
const force = options?.force ?? false
|
|
333
|
-
|
|
334
|
-
if (typeof source === 'string') {
|
|
335
|
-
const stat = await this.stat(source, options)
|
|
336
|
-
|
|
337
|
-
source = stat.cid
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
if (!force) {
|
|
341
|
-
await this.#ensurePathDoesNotExist(destination, options)
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
const fileName = basename(destination)
|
|
345
|
-
const containingDirectory = destination.substring(0, destination.length - `/${fileName}`.length)
|
|
346
|
-
|
|
347
|
-
let trail: PathEntry[] = [{
|
|
348
|
-
cid: root,
|
|
349
|
-
name: ''
|
|
350
|
-
}]
|
|
351
|
-
|
|
352
|
-
if (containingDirectory !== '') {
|
|
353
|
-
trail = await this.#walkPath(root, containingDirectory, {
|
|
354
|
-
...options,
|
|
355
|
-
createMissingDirectories: options?.force ?? false,
|
|
356
|
-
finalSegmentMustBeDirectory: true
|
|
357
|
-
})
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
trail.push({
|
|
361
|
-
cid: source,
|
|
362
|
-
name: fileName
|
|
363
|
-
})
|
|
364
|
-
|
|
365
|
-
this.root = await this.#persistPath(trail, options)
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
async * ls (path?: string, options?: Partial<LsOptions>): AsyncIterable<UnixFSEntry> {
|
|
369
|
-
const root = await this.#getRootCID()
|
|
370
|
-
|
|
371
|
-
if (options?.path != null) {
|
|
372
|
-
path = `${path}/${options.path}`
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
yield * this.unixfs.ls(root, {
|
|
376
|
-
...options,
|
|
377
|
-
path
|
|
378
|
-
})
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
async mkdir (path: string, options?: Partial<MkdirOptions>): Promise<void> {
|
|
382
|
-
const force = options?.force ?? false
|
|
383
|
-
|
|
384
|
-
if (!force) {
|
|
385
|
-
await this.#ensurePathDoesNotExist(path, options)
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
const dirName = basename(path)
|
|
389
|
-
const containingDirectory = path.substring(0, path.length - `/${dirName}`.length)
|
|
390
|
-
const root = await this.#getRootCID()
|
|
391
|
-
|
|
392
|
-
let trail: PathEntry[] = [{
|
|
393
|
-
cid: root,
|
|
394
|
-
name: ''
|
|
395
|
-
}]
|
|
396
|
-
|
|
397
|
-
if (containingDirectory !== '') {
|
|
398
|
-
trail = await this.#walkPath(root, containingDirectory, {
|
|
399
|
-
...options,
|
|
400
|
-
createMissingDirectories: force,
|
|
401
|
-
finalSegmentMustBeDirectory: true
|
|
402
|
-
})
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
trail.push({
|
|
406
|
-
cid: await this.unixfs.addDirectory({
|
|
407
|
-
mode: options?.mode,
|
|
408
|
-
mtime: options?.mtime
|
|
409
|
-
}, options),
|
|
410
|
-
name: basename(path)
|
|
411
|
-
})
|
|
412
|
-
|
|
413
|
-
this.root = await this.#persistPath(trail, options)
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
async rm (path: string, options?: Partial<RmOptions>): Promise<void> {
|
|
417
|
-
const force = options?.force ?? false
|
|
418
|
-
|
|
419
|
-
if (!force) {
|
|
420
|
-
await this.#ensurePathExists(path, options)
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
const root = await this.#getRootCID()
|
|
424
|
-
|
|
425
|
-
const trail = await this.#walkPath(root, path, {
|
|
426
|
-
...options,
|
|
427
|
-
createMissingDirectories: false,
|
|
428
|
-
finalSegmentMustBeDirectory: false
|
|
429
|
-
})
|
|
430
|
-
|
|
431
|
-
const lastSegment = trail.pop()
|
|
432
|
-
|
|
433
|
-
if (lastSegment == null) {
|
|
434
|
-
throw new InvalidParametersError('path was too short')
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
// remove directory entry
|
|
438
|
-
const containingDir = trail[trail.length - 1]
|
|
439
|
-
containingDir.cid = await this.unixfs.rm(containingDir.cid, lastSegment.name, options)
|
|
440
|
-
|
|
441
|
-
this.root = await this.#persistPath(trail, options)
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
async stat (path: string, options?: StatOptions): Promise<FileStats | DirectoryStats | RawStats>
|
|
445
|
-
async stat (path: string, options?: ExtendedStatOptions): Promise<ExtendedFileStats | ExtendedDirectoryStats | ExtendedRawStats>
|
|
446
|
-
async stat (path: string, options?: StatOptions | ExtendedStatOptions): Promise<FileStats | DirectoryStats | RawStats | ExtendedFileStats | ExtendedDirectoryStats | ExtendedRawStats> {
|
|
447
|
-
const root = await this.#getRootCID()
|
|
448
|
-
|
|
449
|
-
const trail = await this.#walkPath(root, path, {
|
|
450
|
-
...options,
|
|
451
|
-
createMissingDirectories: false,
|
|
452
|
-
finalSegmentMustBeDirectory: false
|
|
453
|
-
})
|
|
454
|
-
|
|
455
|
-
const finalEntry = trail.pop()
|
|
456
|
-
|
|
457
|
-
if (finalEntry == null) {
|
|
458
|
-
throw new DoesNotExistError()
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
return this.unixfs.stat(finalEntry.cid, options)
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
async touch (path: string, options?: Partial<TouchOptions>): Promise<void> {
|
|
465
|
-
const root = await this.#getRootCID()
|
|
466
|
-
const trail = await this.#walkPath(root, path, {
|
|
467
|
-
...options,
|
|
468
|
-
createMissingDirectories: false,
|
|
469
|
-
finalSegmentMustBeDirectory: false
|
|
470
|
-
})
|
|
471
|
-
|
|
472
|
-
const finalEntry = trail[trail.length - 1]
|
|
473
|
-
|
|
474
|
-
if (finalEntry == null) {
|
|
475
|
-
throw new DoesNotExistError()
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
finalEntry.cid = await this.unixfs.touch(finalEntry.cid, options)
|
|
479
|
-
|
|
480
|
-
this.root = await this.#persistPath(trail, options)
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
async #walkPath (root: CID, path: string, opts: WalkPathOptions): Promise<PathEntry[]> {
|
|
484
|
-
if (!path.startsWith('/')) {
|
|
485
|
-
throw new InvalidParametersError('path must be absolute')
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
const stat = await this.unixfs.stat(root, {
|
|
489
|
-
...opts,
|
|
490
|
-
offline: true
|
|
491
|
-
})
|
|
492
|
-
|
|
493
|
-
const output: PathEntry[] = [{
|
|
494
|
-
cid: root,
|
|
495
|
-
name: '',
|
|
496
|
-
unixfs: stat.unixfs
|
|
497
|
-
}]
|
|
498
|
-
|
|
499
|
-
let cid = root
|
|
500
|
-
const parts = path.split('/').filter(Boolean)
|
|
501
|
-
|
|
502
|
-
for (let i = 0; i < parts.length; i++) {
|
|
503
|
-
const segment = parts[i]
|
|
504
|
-
|
|
505
|
-
try {
|
|
506
|
-
const stat = await this.unixfs.stat(cid, {
|
|
507
|
-
...opts,
|
|
508
|
-
offline: true,
|
|
509
|
-
path: segment
|
|
510
|
-
})
|
|
511
|
-
|
|
512
|
-
output.push({
|
|
513
|
-
cid: stat.cid,
|
|
514
|
-
name: segment,
|
|
515
|
-
unixfs: stat.unixfs
|
|
516
|
-
})
|
|
517
|
-
|
|
518
|
-
cid = stat.cid
|
|
519
|
-
} catch (err) {
|
|
520
|
-
log.error('could not resolve path segment %s of %s under %c', segment, path, root)
|
|
521
|
-
|
|
522
|
-
if (opts.createMissingDirectories) {
|
|
523
|
-
const cid = await this.unixfs.addDirectory()
|
|
524
|
-
|
|
525
|
-
output.push({
|
|
526
|
-
cid,
|
|
527
|
-
name: segment,
|
|
528
|
-
unixfs: new IPFSUnixFS({ type: 'directory' })
|
|
529
|
-
})
|
|
530
|
-
} else {
|
|
531
|
-
throw new DoesNotExistError(`${path} does not exist`)
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
const lastSegment = output[output.length - 1]
|
|
537
|
-
|
|
538
|
-
if (opts.finalSegmentMustBeDirectory && lastSegment.unixfs?.isDirectory() !== true) {
|
|
539
|
-
throw new NotADirectoryError(`${path} was not a directory`)
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
return output
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
async #persistPath (path: PathEntry[], options: Partial<CpOptions> = {}): Promise<CID> {
|
|
546
|
-
let child = path.pop()
|
|
547
|
-
|
|
548
|
-
if (child == null) {
|
|
549
|
-
throw new InvalidParametersError('path was too short')
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
let cid = child.cid
|
|
553
|
-
|
|
554
|
-
for (let i = path.length - 1; i > -1; i--) {
|
|
555
|
-
const segment = path[i]
|
|
556
|
-
segment.cid = await this.unixfs.cp(child.cid, segment.cid, child.name, {
|
|
557
|
-
...options,
|
|
558
|
-
force: true
|
|
559
|
-
})
|
|
560
|
-
|
|
561
|
-
child = segment
|
|
562
|
-
cid = segment.cid
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
await this.components.datastore.put(this.key, cid.bytes, options)
|
|
566
|
-
|
|
567
|
-
return cid
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
async #ensurePathExists (path: string, options: StatOptions = {}): Promise<void> {
|
|
571
|
-
const exists = await this.#pathExists(path, options)
|
|
572
|
-
|
|
573
|
-
if (!exists) {
|
|
574
|
-
throw new DoesNotExistError()
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
async #ensurePathDoesNotExist (path: string, options: StatOptions = {}): Promise<void> {
|
|
579
|
-
const exists = await this.#pathExists(path, options)
|
|
580
|
-
|
|
581
|
-
if (exists) {
|
|
582
|
-
throw new AlreadyExistsError()
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
async #pathExists (path: string, options: StatOptions = {}): Promise<boolean> {
|
|
587
|
-
try {
|
|
588
|
-
await this.stat(path, {
|
|
589
|
-
...options,
|
|
590
|
-
offline: true
|
|
591
|
-
})
|
|
592
|
-
|
|
593
|
-
return true
|
|
594
|
-
} catch {
|
|
595
|
-
return false
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
|
|
600
234
|
/**
|
|
601
235
|
* Create a {@link MFS} instance powered by {@link https://github.com/ipfs/helia Helia}
|
|
602
236
|
*/
|
|
603
|
-
export function mfs (helia: { blockstore: Blockstore, datastore: Datastore }, init: MFSInit = {}): MFS {
|
|
604
|
-
return new
|
|
237
|
+
export function mfs (helia: { blockstore: Blockstore, datastore: Datastore, logger: ComponentLogger }, init: MFSInit = {}): MFS {
|
|
238
|
+
return new MFSClass(helia, init)
|
|
605
239
|
}
|