From 2907510b6ea0399513de6babb1149ccf4733c754 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 10 Apr 2018 13:33:13 -0400 Subject: [PATCH] fix arrows in ipfs get by using ipfsConnection.get --- lib/modules/ipfs/embarkjs.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/modules/ipfs/embarkjs.js b/lib/modules/ipfs/embarkjs.js index 0412babd..c2e516e0 100644 --- a/lib/modules/ipfs/embarkjs.js +++ b/lib/modules/ipfs/embarkjs.js @@ -37,7 +37,7 @@ __embarkIPFS.saveText = function(text) { var connectionError = new Error('No IPFS connection. Please ensure to call Embark.Storage.setProvider()'); reject(connectionError); } - self.ipfsConnection.add((new self.ipfsConnection.Buffer(text)), function(err, result) { + self.ipfsConnection.add(self.ipfsConnection.Buffer.from(text), function(err, result) { if (err) { reject(err); } else { @@ -58,10 +58,11 @@ __embarkIPFS.get = function(hash) { var connectionError = new Error('No IPFS connection. Please ensure to call Embark.Storage.setProvider()'); reject(connectionError); } - self.ipfsConnection.object.get(hash).then(function(node) { - resolve(node.data.toString()); - }).catch(function(err) { - reject(err); + self.ipfsConnection.get(hash, function (err, files) { + if (err) { + return reject(err); + } + resolve(files[0].content.toString()); }); });