Skip to content

Commit eb1f356

Browse files
committed
WIP support support specify hash alg
1 parent 5aa613b commit eb1f356

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/files/add.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,27 @@ module.exports = (send) => {
2121
return callback(new Error('"files" must be a buffer, readable stream, or array of objects'))
2222
}
2323

24-
const request = { path: 'add', files: files, qs: opts }
24+
const qs = {}
25+
26+
if (opts['cid-version'] != null) {
27+
qs['cid-version'] = opts['cid-version']
28+
} else if (opts.cidVersion != null) {
29+
qs['cid-version'] = opts.cidVersion
30+
}
31+
32+
if (opts['raw-leaves'] != null) {
33+
qs['raw-leaves'] = opts['raw-version']
34+
} else if (opts.rawLeaves != null) {
35+
qs['raw-leaves'] = opts.rawLeaves
36+
}
37+
38+
if (opts.hash != null) {
39+
qs.hash = opts.hash
40+
} else if (opts.hashAlg != null) {
41+
qs.hash = opts.hashAlg
42+
}
43+
44+
const request = { path: 'add', files: files, qs: qs }
2545

2646
// Transform the response stream to DAGNode values
2747
const transform = (res, callback) => DAGNodeStream.streamToValue(send, res, callback)

0 commit comments

Comments
 (0)