Way to identify if a hash is a directory or a file

Is there a way to know if a given hash is a directory or a file?

test "$(ipfs dag get Qm... | jq .data)" = '"CAE="'

If true, it’s a directory