
Stream-based tar reader/writer with buffered I/O, entry header parsing and current-file access, append-friendly ordering for immutable data, and validation against GNU tar specification.
This repository is a kotlin multiplatform library to read and create a tar. It uses kotlinx-io for the I/O part. Really basic support for now.
If you have immutable data that doesn't need to be partially accessed, that's the perfect format! Also a specificity of a tar is that if you add more data to it, you can redownload only the difference as the tar will keep the order.
SystemFileSystem.source(Path("my.tar"))
.buffered()
.tar().use { tar ->
var nextEntry: TarEntry? = null
while (tar.nextEntry.also { nextEntry = it } != null) {
if (nextEntry != null) {
val headerInfo = nextEntry.header
val fileDataSource = tar.currentFile()
}
}
}val folder = "/tmp"
SystemFileSystem.sink(Path("myNew.tar"))
.buffered()
.tar().use { tarSink ->
listOf("file1.txt", "flie2.xml").forEach { fileName ->
val path = Path("$folder/$fileName")
if (SystemFileSystem.exists(path)) {
tarSink.putNextEntry(TarEntry(path, fileName))
tarSink.write(path)
}
}
}We are pascap LTD a small startup, if you want to support us don't hesitate to try our app on the play store, we use that library in production with that application.
No llm has been used for that repository.
This repository is a kotlin multiplatform library to read and create a tar. It uses kotlinx-io for the I/O part. Really basic support for now.
If you have immutable data that doesn't need to be partially accessed, that's the perfect format! Also a specificity of a tar is that if you add more data to it, you can redownload only the difference as the tar will keep the order.
SystemFileSystem.source(Path("my.tar"))
.buffered()
.tar().use { tar ->
var nextEntry: TarEntry? = null
while (tar.nextEntry.also { nextEntry = it } != null) {
if (nextEntry != null) {
val headerInfo = nextEntry.header
val fileDataSource = tar.currentFile()
}
}
}val folder = "/tmp"
SystemFileSystem.sink(Path("myNew.tar"))
.buffered()
.tar().use { tarSink ->
listOf("file1.txt", "flie2.xml").forEach { fileName ->
val path = Path("$folder/$fileName")
if (SystemFileSystem.exists(path)) {
tarSink.putNextEntry(TarEntry(path, fileName))
tarSink.write(path)
}
}
}We are pascap LTD a small startup, if you want to support us don't hesitate to try our app on the play store, we use that library in production with that application.
No llm has been used for that repository.