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

Commit

Permalink
fix(dag): use SendOneFile for dag put
Browse files Browse the repository at this point in the history
There was a refactoring, now the usual way of doing a HTTP request
is through SendOneFile.
  • Loading branch information
vmx authored and daviddias committed Apr 5, 2018
1 parent 2683c7e commit 9c37213
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/dag/put.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ const dagCBOR = require('ipld-dag-cbor')
const promisify = require('promisify-es6')
const CID = require('cids')
const multihash = require('multihashes')
const SendOneFile = require('../utils/send-one-file')

function noop () {}

module.exports = (send) => {
const sendOneFile = SendOneFile(send, 'dag/put')

return promisify((dagNode, options, callback) => {
if (typeof options === 'function') {
return setImmediate(() => callback(new Error('no options were passed')))
Expand Down Expand Up @@ -44,16 +47,14 @@ module.exports = (send) => {

function finalize (err, serialized) {
if (err) { return callback(err) }

send({
path: 'dag/put',
const sendOptions = {
qs: {
hash: hashAlg,
format: format,
'input-enc': inputEnc
},
files: serialized
}, (err, result) => {
}
}
sendOneFile(serialized, sendOptions, (err, result) => {
if (err) {
return callback(err)
}
Expand Down

0 comments on commit 9c37213

Please sign in to comment.