code: function addToTree (elem, callback) {
      const pathElems = toPathComponents(elem.path || '')
      let parent = tree
      const lastIndex = pathElems.length - 1
  
      let currentPath = ''
      eachOfSeries(pathElems, (pathElem, index, callback) => {
        if (currentPath) {
          currentPath += '/'
        }
        currentPath += pathElem
        const last = (index === lastIndex)
        parent.dirty = true
        parent.multihash = null
        parent.size = null
  
        if (last) {
          waterfall([
            (callback) => parent.put(pathElem, elem, callback),
            (callback) => flatToShard(null, parent, options.shardSplitThreshold, options, callback),
            (newRoot, callback) => {
              tree = newRoot
              callback()
            }
          ], callback)
        } else {
          parent.get(pathElem, (err, treeNode) => {
            if (err) {
              callback(err)
              return // early
            }
            let dir = treeNode
            if (!dir || !(dir instanceof Dir)) {
              dir = DirFlat({
                dir: true,
                parent: parent,
                parentKey: pathElem,
                path: currentPath,
                dirty: true,
                flat: true
              }, options)
            }
            const parentDir = parent
            parent = dir
            parentDir.put(pathElem, dir, callback)
          })
        }
      }, callback)
    }
docs: ---- Add to tree