1
- 'use strict'
2
-
3
- const errCode = require ( 'err-code' )
4
- const { CID } = require ( 'multiformats/cid' )
5
- const resolve = require ( './resolvers' )
6
- const last = require ( 'it-last' )
1
+ import errCode from 'err-code'
2
+ import { CID } from 'multiformats/cid'
3
+ import resolve from './resolvers/index.js'
4
+ import last from 'it-last'
7
5
8
6
/**
9
7
* @typedef {import('ipfs-unixfs').UnixFS } UnixFS
@@ -65,7 +63,7 @@ const cidAndRest = (path) => {
65
63
* @param {Blockstore } blockstore
66
64
* @param {ExporterOptions } [options]
67
65
*/
68
- async function * walkPath ( path , blockstore , options = { } ) {
66
+ export async function * walkPath ( path , blockstore , options = { } ) {
69
67
let {
70
68
cid,
71
69
toResolve
@@ -102,7 +100,7 @@ async function * walkPath (path, blockstore, options = {}) {
102
100
* @param {Blockstore } blockstore
103
101
* @param {ExporterOptions } [options]
104
102
*/
105
- async function exporter ( path , blockstore , options = { } ) {
103
+ export async function exporter ( path , blockstore , options = { } ) {
106
104
const result = await last ( walkPath ( path , blockstore , options ) )
107
105
108
106
if ( ! result ) {
@@ -117,7 +115,7 @@ async function exporter (path, blockstore, options = {}) {
117
115
* @param {Blockstore } blockstore
118
116
* @param {ExporterOptions } [options]
119
117
*/
120
- async function * recursive ( path , blockstore , options = { } ) {
118
+ export async function * recursive ( path , blockstore , options = { } ) {
121
119
const node = await exporter ( path , blockstore , options )
122
120
123
121
if ( ! node ) {
@@ -151,9 +149,3 @@ async function * recursive (path, blockstore, options = {}) {
151
149
}
152
150
}
153
151
}
154
-
155
- module . exports = {
156
- exporter,
157
- walkPath,
158
- recursive
159
- }
0 commit comments