Skip to content

Commit 5c9fa18

Browse files
committed
chore: change block args
1 parent 3e2f404 commit 5c9fa18

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

packages/ipfs-unixfs-importer/src/utils/persist.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,17 @@ const persist = async (buffer, block, options) => {
2525
options.cidVersion = 1
2626
}
2727

28+
const multihash = await mh(buffer, options.hashAlg)
29+
const cid = new CID(options.cidVersion, options.codec, multihash)
30+
2831
if (options.onlyHash) {
29-
return new CID(
30-
options.cidVersion,
31-
options.codec,
32-
await mh(buffer, options.hashAlg)
33-
)
32+
return cid
3433
}
3534

36-
const {
37-
cid
38-
} = await block.put(buffer, {
39-
version: options.cidVersion,
40-
format: options.codec,
41-
mhtype: options.hashAlg,
35+
await block.put(buffer, {
4236
pin: options.pin,
43-
preload: options.preload
37+
preload: options.preload,
38+
cid
4439
})
4540

4641
return cid

0 commit comments

Comments
 (0)