diff --git a/package.json b/package.json index fc8f27f53f..7355b74bf4 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "detect-node": "^2.0.3", "glob": "^7.0.6", "hapi": "^15.0.3", - "ipfs-api": "^8.0.3", + "ipfs-api": "^8.0.4", "ipfs-bitswap": "^0.7.0", "ipfs-block": "^0.3.0", "ipfs-block-service": "^0.5.0", @@ -132,4 +132,4 @@ "nginnever ", "npmcdn-to-unpkg-bot " ] -} \ No newline at end of file +} diff --git a/src/cli/commands/files/add.js b/src/cli/commands/files/add.js index eb13ac1cb9..047fd34c91 100644 --- a/src/cli/commands/files/add.js +++ b/src/cli/commands/files/add.js @@ -55,11 +55,17 @@ module.exports = { const index = inPath.lastIndexOf('/') + 1 utils.getIPFS((err, ipfs) => { - if (err) throw err + if (err) { + throw err + } glob(path.join(inPath, '/**/*'), (err, list) => { - if (err) throw err - if (list.length === 0) list = [inPath] + if (err) { + throw err + } + if (list.length === 0) { + list = [inPath] + } pull( zip( diff --git a/src/cli/commands/files/cat.js b/src/cli/commands/files/cat.js index 34737439ae..7c16b9aa6e 100644 --- a/src/cli/commands/files/cat.js +++ b/src/cli/commands/files/cat.js @@ -18,21 +18,15 @@ module.exports = { if (err) { throw err } - if (utils.isDaemonOn()) { - ipfs.cat(path, (err, res) => { - if (err) { - throw err - } - console.log(res.toString()) - }) - return - } - ipfs.files.cat(path, (err, file) => { - if (err) { - throw (err) - } - file.pipe(process.stdout) - }) + + ipfs.files.cat(path, onFile) }) } } + +function onFile (err, file) { + if (err) { + throw (err) + } + file.pipe(process.stdout) +} diff --git a/test/cli/test-files.js b/test/cli/test-files.js index a9a5bf68cb..572c6fffec 100644 --- a/test/cli/test-files.js +++ b/test/cli/test-files.js @@ -80,6 +80,7 @@ describe('files', () => { .run((err, stdout, exitcode) => { expect(err).to.not.exist expect(exitcode).to.equal(0) + expect(stdout[0]).to.equal('hello world') done() }) })