Skip to content

husker-dev/NioEx

Repository files navigation

NioEx

Advanced I/O usage in Kotlin

Features

  • Speedometers for every operation
  • Zipping file/folder
  • Unzipping
  • Copying
  • Downloading from URL
  • OS acceleration (in future)

Examples

Here are some of examples, to see all of them, follow this link

  • Zip file

    // Zip to archive
    fileToZip.zipTo("archive.zip")
  • Zip several files

    // Zip file array
    fileToZip.children.zipTo("archive.zip")
  • Zip file with speedometer

    fileToZip.zipTo("archive.zip", ZipSpeedometer().apply {
        updateDelay = 10
        speedUpdateDelay = 10
        
        onStarted {
            println("Zipping started!")
        }
        onCompleted {
            println("Zipping completed!")
        }
        onUpdate {
            println("-------------------------")
            println("Size: ${it.size}")
            println("Zipped bytes: ${it.current}")
            println("Zipping entry: ${it.entry}")
            println("Zipping file: ${it.file}")
            println("Speed: ${it.bytesPerSecond}")
        }
    })