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

Commit 5878a0a

Browse files
achingbrainAlan Shaw
authored and
Alan Shaw
committed
feat: allow controlling preload from cli and http api (#2384)
1 parent beb2bd2 commit 5878a0a

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/cli/commands/add.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ module.exports = {
149149
type: 'boolean',
150150
default: true,
151151
describe: 'Pin this object when adding'
152+
},
153+
preload: {
154+
type: 'boolean',
155+
default: true,
156+
describe: 'Preload this object when adding'
152157
}
153158
},
154159

@@ -166,7 +171,8 @@ module.exports = {
166171
hashAlg: argv.hash,
167172
wrapWithDirectory: argv.wrapWithDirectory,
168173
pin: argv.pin,
169-
chunker: argv.chunker
174+
chunker: argv.chunker,
175+
preload: argv.preload
170176
}
171177

172178
if (options.enableShardingExperiment && argv.isDaemonOn()) {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ exports.add = {
162162
pin: Joi.boolean().default(true),
163163
'wrap-with-directory': Joi.boolean(),
164164
chunker: Joi.string(),
165-
trickle: Joi.boolean()
165+
trickle: Joi.boolean(),
166+
preload: Joi.boolean().default(true)
166167
})
167168
// TODO: Necessary until validate "recursive", "stream-channels" etc.
168169
.options({ allowUnknown: true })
@@ -220,7 +221,8 @@ exports.add = {
220221
wrapWithDirectory: request.query['wrap-with-directory'],
221222
pin: request.query.pin,
222223
chunker: request.query.chunker,
223-
strategy: request.query.trickle ? 'trickle' : 'balanced'
224+
strategy: request.query.trickle ? 'trickle' : 'balanced',
225+
preload: request.query.preload
224226
}
225227

226228
const aborter = abortable()

0 commit comments

Comments
 (0)