mirror of https://github.com/embarklabs/embark.git
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:
commit
8f95dd0939
|
@ -37,7 +37,7 @@ __embarkIPFS.saveText = function(text) {
|
||||||
var connectionError = new Error('No IPFS connection. Please ensure to call Embark.Storage.setProvider()');
|
var connectionError = new Error('No IPFS connection. Please ensure to call Embark.Storage.setProvider()');
|
||||||
reject(connectionError);
|
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) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
} else {
|
} else {
|
||||||
|
@ -58,10 +58,11 @@ __embarkIPFS.get = function(hash) {
|
||||||
var connectionError = new Error('No IPFS connection. Please ensure to call Embark.Storage.setProvider()');
|
var connectionError = new Error('No IPFS connection. Please ensure to call Embark.Storage.setProvider()');
|
||||||
reject(connectionError);
|
reject(connectionError);
|
||||||
}
|
}
|
||||||
self.ipfsConnection.object.get(hash).then(function(node) {
|
self.ipfsConnection.get(hash, function (err, files) {
|
||||||
resolve(node.data.toString());
|
if (err) {
|
||||||
}).catch(function(err) {
|
return reject(err);
|
||||||
reject(err);
|
}
|
||||||
|
resolve(files[0].content.toString());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue