   (let [hex (multihash/hex id)]
     (io/file
       root
-      (subs hex 0 4)
-      (subs hex 4 6)
-      (subs hex 6 8)
-      (subs hex 8))))
+      (subs hex 0 dir-prefix-length)
+      (subs hex dir-prefix-length))))
 
 
 (defn- file->id

  "Block storage backed by files in nested directories. Each block is stored in
  a separate file.

  In many filesystems, directories are limited to 4,096 entries. In order to
  avoid this limit (and make navigating the blocks a bit more efficient), block
  content is stored in nested directories three levels deep. All path elements
  are lower-case hex-encoded bytes from the multihash.

  The first level is the two-byte multihash prefix, which designates the
  algorithm and digest length. There will usually only be one or two of these
  directories. The second and third levels are formed by the first two bytes of
  the hash digest. Finally, the block is stored in a file containing the rest of
  the digest.

  Thus, a block containing the content `foobar` would have the sha1 digest
  `97df3501149...` and be stored under the root directory at:

  `root/1114/97/df/35011497df3588b5a3...`

  Using this scheme, leaf directories should start approaching the limit once the
  user has 2^28 entries, or about 268 million blocks."
  (:require
    (blocks
      [core :as block]


;; ## File Block Functions

(def ^:private dir-prefix-length
  "Number of characters to use as a prefix for top-level directory names."
  8)


(defn- file-stats
  "Calculates storage stats for a block file."
  [^File file]
