Merge pull request #353 from embark-framework/bug_fix/arrows-ipfs-get-windows

Fix weird characters in IPFS get by using ipfsConnection.get
This commit is contained in:
Iuri Matias 2018-04-10 13:57:51 -04:00 committed by GitHub
commit 8f95dd0939
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -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());
});
});