File size: 444 Bytes
e079a73
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import {Directory} from "expo-file-system"

export function printDirectory(directory: Directory, indent: number = 0) {
  console.log(`${" ".repeat(indent)} + ${directory.name}`)
  const contents = directory.list()
  for (const item of contents) {
    if (item instanceof Directory) {
      printDirectory(item, indent + 2)
    } else {
      console.log(`${" ".repeat(indent + 2)} - ${item.name} (${item.size} bytes)`)
    }
  }
}