Package-level declarations

Functions

Link copied to clipboard
suspend fun <T> Flow<T>.alsoAppendTo(file: Path, vararg options: OpenOption = arrayOf( StandardOpenOption.WRITE, StandardOpenOption.CREATE ), mapper: suspend (T) -> ByteArray): Flow<T>

Transforms the content of this Flow of type T using the given mapper to a Flow of ByteArrays, then appends the ByteArrays to the specified file while also returning the original content.

Link copied to clipboard
suspend fun <T> Flow<T>.alsoWriteTo(file: Path, vararg options: OpenOption = arrayOf( StandardOpenOption.WRITE, StandardOpenOption.CREATE ), mapper: suspend (T) -> ByteArray): Flow<T>

Transforms the content of this Flow of type T using the given mapper to a Flow of ByteArrays, then writes the ByteArrays to the specified file while also returning the original content.

Link copied to clipboard
suspend fun Path.appendFrom(content: Flow<ByteArray>, vararg options: OpenOption = arrayOf( StandardOpenOption.WRITE, StandardOpenOption.CREATE, ))

Appends the content from a given Flow of ByteArrays to the file at this Path.

Link copied to clipboard
suspend fun Flow<ByteArray>.appendTo(file: Path, vararg options: OpenOption = arrayOf( StandardOpenOption.WRITE, StandardOpenOption.CREATE ))

Appends the content of this Flow of ByteArrays to the specified file.

Link copied to clipboard
fun InputStream.asFlow(dispatcher: CoroutineDispatcher = Dispatchers.IO): Flow<ByteArray>

Converts the content of an InputStream into a Flow of ByteArrays.

Link copied to clipboard
suspend fun Flow<ByteArray>.asInputStream(bufferSize: Int = 1024, dispatcher: CoroutineDispatcher = Dispatchers.IO): InputStream

Converts a Flow of ByteArrays into an InputStream.

Link copied to clipboard

Opens the file at this Path with the specified options and returns an AsynchronousFileChannel to it.

Link copied to clipboard
suspend fun AsynchronousFileChannel.coRead(bufferSize: Int, position: Long): ByteBuffer

Reads content from this AsynchronousFileChannel into a ByteBuffer of the given bufferSize starting at the specified position using a coroutine-friendly API.

Link copied to clipboard
suspend fun AsynchronousFileChannel.coWrite(src: ByteBuffer, position: Long): Int

Writes the content of the given src ByteBuffer to this AsynchronousFileChannel at the specified position using a coroutine-friendly API.

Link copied to clipboard
fun AsynchronousFileChannel.flow(bufferSize: Int = 1024): Flow<ByteArray>

Creates a Flow of ByteArrays by reading the content of this AsynchronousFileChannel using the given bufferSize as the chunk size for each emitted ByteArray.

Link copied to clipboard
fun Path.readAsFlow(bufferSize: Int = 1024, vararg options: OpenOption = arrayOf( StandardOpenOption.READ )): Flow<ByteArray>

Reads the content of the file at this Path into a Flow of ByteArrays. Each emitted ByteArray represents a chunk of the file content based on the specified bufferSize.

Link copied to clipboard
fun readFileAsFlow(file: Path, bufferSize: Int = 1024, vararg options: OpenOption = arrayOf( StandardOpenOption.READ )): Flow<ByteArray>

Reads the content of the specified file into a Flow of ByteArrays using the given bufferSize.

Link copied to clipboard
fun Flow<ByteArray>.unzipFile(dispatcher: CoroutineDispatcher = Dispatchers.IO): Flow<ContentfulZipEntry>

Decompresses the content from a given Flow of ByteArrays representing a ZIP file.

Link copied to clipboard
suspend fun AsynchronousFileChannel.writeFlow(start: Long, content: Flow<ByteArray>)

Writes the content of a Flow of ByteArrays to this AsynchronousFileChannel starting at the specified start position.

Link copied to clipboard
suspend fun Path.writeFrom(content: Flow<ByteArray>, vararg options: OpenOption = arrayOf( StandardOpenOption.WRITE, StandardOpenOption.CREATE, ))

Writes the content from a given Flow of ByteArrays to the file at this Path, starting at the beginning.

Link copied to clipboard
suspend fun Flow<ByteArray>.writeTo(file: Path, vararg options: OpenOption = arrayOf( StandardOpenOption.WRITE, StandardOpenOption.CREATE ))

Writes the content of this Flow of ByteArrays to the specified file.

Link copied to clipboard
fun Flow<ByteArray>.zipFile(entryName: String, dispatcher: CoroutineDispatcher = Dispatchers.IO): Flow<ByteArray>

Compresses the given Flow of ByteArrays into a ZIP file containing a single entry with the provided entryName.