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 committed Mar 28, 2018
1 parent d98f8e1 commit 182014c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 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 182014c

Please sign in to comment.