Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Fs4k - Super-simple file tree manipulation DSL in Kotlin.

Download .github/workflows/build.yaml

GitHub license codebeat badge

File system manipulation in Kotlin with a pluggable file system abstraction. You can set the content of files and directories, and the file system to use.

To create a file system (automatically):

val directory = dir("path", Automatic) {
    text("plainfile.txt") {
        content = "hello"
    }
    binary("binary.png") {
        content = "goodbye".byteInputStream()
    }

    dir("directory") {
        text("file2.html") {
            content = "<html/>"
        }
    }
}

// directory is created automatically
directory.delete()

You can manipulate files in a nested way to only create/delete the parts you need:

dir("parent").dir("child").text("file.txt").delete()

Supported FS types:

  • Disk
  • In-Memory