Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
feat(dag): update option names to reflect go-ipfs API
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k authored and daviddias committed Apr 5, 2018
1 parent 93a9af9 commit 9bf1c6c
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/dag/dag.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = (send) => {

callback = callback || noop

let hashAlg = options.hashAlg || 'sha2-256'
let hashAlg = options.hash || 'sha2-256'
let format
let inputEnc

Expand All @@ -33,20 +33,12 @@ module.exports = (send) => {
}

function prepare () {
if (format === 'dag-cbor') {
// TODO change this once
// https://github.com/ipfs/go-ipfs/issues/3771 is finished
format = 'cbor'
inputEnc = 'raw'

inputEnc = 'cbor'
if (format === 'dag-cbor') {
dagCBOR.util.serialize(dagNode, finalize)
}
if (format === 'dag-pb') {
// TODO change this once
// https://github.com/ipfs/go-ipfs/issues/3771 is finished
format = 'protobuf'

inputEnc = 'protobuf'
dagPB.util.serialize(dagNode, finalize)
}
}
Expand All @@ -57,9 +49,9 @@ module.exports = (send) => {
send({
path: 'dag/put',
qs: {
hashAlg: hashAlg, // not implemented in go yet https://github.com/ipfs/go-ipfs/issues/3771
hash: hashAlg,
format: format,
inputenc: inputEnc
'input-enc': inputEnc
},
files: serialized
}, (err, result) => {
Expand Down

0 comments on commit 9bf1c6c

Please sign in to comment.