'use strict';

var ipfsUnixfs = require('ipfs-unixfs');

async function isShardAtPath(path, ipfs) {
  const stats = await ipfs.files.stat(path);
  const {value: node} = await ipfs.dag.get(stats.cid);
  const entry = ipfsUnixfs.UnixFS.unmarshal(node.Data);
  return entry.type === 'hamt-sharded-directory';
}

module.exports = isShardAtPath;
