Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 4e61958

Browse files
there is no cat
1 parent 3e4e2fd commit 4e61958

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/cli/commands/files/cat.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,23 @@ module.exports = {
1414

1515
handler (argv) {
1616
const path = argv['ipfs-path']
17-
1817
utils.getIPFS((err, ipfs) => {
1918
if (err) {
2019
throw err
2120
}
2221

23-
ipfs.files.cat(path, (err, file) => {
24-
if (err) {
25-
throw (err)
26-
}
22+
if (utils.isDaemonOn()) {
23+
return ipfs.cat(path, onFile)
24+
}
2725

28-
file.pipe(process.stdout)
29-
})
26+
ipfs.files.cat(path, onFile)
3027
})
3128
}
3229
}
30+
31+
function onFile (err, file) {
32+
if (err) {
33+
throw (err)
34+
}
35+
file.pipe(process.stdout)
36+
}

0 commit comments

Comments
 (0)