Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit b35845e

Browse files
committed
fix: choose import strategy in ipfs.add (#2541)
* fix: choose import strategy in ipfs.add The interface spec says you should pass a `trickle` boolean to `ipfs.add` to get a trickle DAG, this PR makes us actually do that instead of passing `strategy: 'whatever'`. * fix: remove trickle arg before passing to importer
1 parent 6c4f081 commit b35845e

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/cli/commands/add.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ module.exports = {
113113
argv.resolve((async () => {
114114
const ipfs = await argv.getIpfs()
115115
const options = {
116-
strategy: argv.trickle ? 'trickle' : 'balanced',
116+
trickle: argv.trickle,
117117
shardSplitThreshold: argv.enableShardingExperiment
118118
? argv.shardSplitThreshold
119119
: Infinity,

src/core/components/files-regular/add-async-iterator.js

+7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = function (self) {
2121
? 1000
2222
: Infinity
2323
}, options, {
24+
strategy: 'balanced',
2425
chunker: chunkerOptions.chunker,
2526
chunkerOptions: chunkerOptions.chunkerOptions
2627
})
@@ -30,6 +31,12 @@ module.exports = function (self) {
3031
opts.cidVersion = 1
3132
}
3233

34+
if (opts.trickle) {
35+
opts.strategy = 'trickle'
36+
}
37+
38+
delete opts.trickle
39+
3340
let total = 0
3441

3542
const prog = opts.progress || noop

src/http/api/resources/files-regular.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ exports.add = {
219219
wrapWithDirectory: request.query['wrap-with-directory'],
220220
pin: request.query.pin,
221221
chunker: request.query.chunker,
222-
strategy: request.query.trickle ? 'trickle' : 'balanced',
222+
trickle: request.query.trickle,
223223
preload: request.query.preload
224224
})
225225
},

0 commit comments

Comments
 (0)