Turns directory structures into plain ol' JS objects and vice versa.