Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Promisify "add" and "createAddStream".
Browse files Browse the repository at this point in the history
  • Loading branch information
hackergrrl committed May 27, 2016
1 parent 72134d5 commit 31e7c8d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/core/ipfs/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ const UnixFS = require('ipfs-unixfs')
const bs58 = require('bs58')
const through = require('through2')
const isStream = require('isstream')
const promisify = require('promisify-es6')

module.exports = function files (self) {
return {
createAddStream: (callback) => {
createAddStream: promisify((callback) => {
// TODO: wip
if (data === undefined) {
return new Importer(self._dagS)
}
},
}),

add: (data, callback) => {
add: promisify((data, callback) => {
// Buffer input
if (Buffer.isBuffer(data)) {
data = [{
Expand Down Expand Up @@ -61,7 +62,8 @@ module.exports = function files (self) {
})

i.end()
},
}),

cat: (hash, callback) => {
self._dagS.get(hash, (err, fetchedNode) => {
if (err) {
Expand Down

0 comments on commit 31e7c8d

Please sign in to comment.