When adding a file or folder, both go-ipfs and js-ipfs print to the console something like:
added QmVes6R29KZ18VizBmuUmppFAbVjbxV2iYGz41pAdeDPdS public/tags/stream
However, when go-ipfs gets piped into another command, it commits both the added and public/tags/stream and only passes the hash, while js-ipfs send the whole thing.
The difference in behavior makes it so that it is hard to switch back and forth as this breaks some tooling to (for example) publish websites.
I'm unaware of how the node process would know it is being piped - I've never needed it before!
Are you sure this is the case? I just saw https://github.com/ipfs/ipfs/issues/337#issuecomment-455164513 and Kyle is using the -q flag to make the output only include CIDs.
FWIW, you can find out if stdin/stdout is being piped by inspecting the isTTY property - e.g. process.stdout.isTTY will be false if the current processes' output is being piped to another process.
Go IPFS:
$ echo "hello" | ipfs add | cat
6 B / ? [--------------------------------------------------------------=-----] added QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN
$ echo "hello" | ipfs add -q | cat
QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN
I think what you might have been seeing was js-ipfs adding "added" even if -q was set. I fixed this here and it has been released in js-ipfs 0.34.1:
$ echo "hello" | jsipfs add | cat
added QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN
$ echo "hello" | jsipfs add -q | cat
QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN
@alanshaw you are right! https://github.com/daviddias/daviddias.me/blob/master/Makefile#L40
Most helpful comment
@alanshaw you are right! https://github.com/daviddias/daviddias.me/blob/master/Makefile#L40