diff --git a/src/cli/commands/files/cat.js b/src/cli/commands/files/cat.js index 34737439ae..e2be436765 100644 --- a/src/cli/commands/files/cat.js +++ b/src/cli/commands/files/cat.js @@ -14,23 +14,17 @@ module.exports = { handler (argv) { const path = argv['ipfs-path'] + utils.getIPFS((err, ipfs) => { 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) }) }) 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() }) })