package file
- Alphabetic
- By Inheritance
- file
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
trait
FileHandle[F[_]] extends AnyRef
Provides the ability to read/write/lock/inspect a file in the effect
F
. -
final
case class
ReadCursor[F[_]](file: FileHandle[F], offset: Long) extends Product with Serializable
Associates a
FileHandle
with an offset in to the file.Associates a
FileHandle
with an offset in to the file.This encapsulates the pattern of incrementally reading bytes in from a file, a chunk at a time. Convenience methods are provided for working with pulls.
-
final
case class
WriteCursor[F[_]](file: FileHandle[F], offset: Long) extends Product with Serializable
Associates a
FileHandle
with an offset in to the file.Associates a
FileHandle
with an offset in to the file.This encapsulates the pattern of incrementally writing bytes in to a file, a chunk at a time. Convenience methods are provided for working with pulls.
Value Members
-
def
copy[F[_]](blocker: Blocker, source: Path, target: Path, flags: Seq[CopyOption] = Seq.empty)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Path]
Copies a file from the source to the target path,
Copies a file from the source to the target path,
By default, the copy fails if the target file already exists or is a symbolic link.
-
def
createDirectories[F[_]](blocker: Blocker, path: Path, flags: Seq[FileAttribute[_]] = Seq.empty)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Path]
Creates a new directory at the given path and creates all nonexistent parent directories beforehand.
-
def
createDirectory[F[_]](blocker: Blocker, path: Path, flags: Seq[FileAttribute[_]] = Seq.empty)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Path]
Creates a new directory at the given path
-
def
delete[F[_]](blocker: Blocker, path: Path)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Unit]
Deletes a file.
Deletes a file.
If the file is a directory then the directory must be empty for this action to succed. This action will fail if the path doesn't exist.
-
def
deleteIfExists[F[_]](blocker: Blocker, path: Path)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Boolean]
Like
delete
, but will not fail when the path doesn't exist. -
def
directoryStream[F[_]](blocker: Blocker, path: Path, glob: String)(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Path]
Creates a stream of Paths inside a directory which match the given glob.
-
def
directoryStream[F[_]](blocker: Blocker, path: Path, filter: (Path) ⇒ Boolean)(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Path]
Creates a stream of Paths inside a directory, filtering the results by the given predicate.
-
def
directoryStream[F[_]](blocker: Blocker, path: Path)(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Path]
Creates a stream of Paths inside a directory.
-
def
exists[F[_]](blocker: Blocker, path: Path, flags: Seq[LinkOption] = Seq.empty)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Boolean]
Checks if a file exists
Checks if a file exists
Note that the result of this method is immediately outdated. If this method indicates the file exists then there is no guarantee that a subsequence access will succeed. Care should be taken when using this method in security sensitive applications.
-
def
move[F[_]](blocker: Blocker, source: Path, target: Path, flags: Seq[CopyOption] = Seq.empty)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Path]
Moves (or renames) a file from the source to the target path.
Moves (or renames) a file from the source to the target path.
By default, the move fails if the target file already exists or is a symbolic link.
-
def
readAll[F[_]](path: Path, blocker: Blocker, chunkSize: Int)(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Byte]
Reads all data synchronously from the file at the specified
java.nio.file.Path
. -
def
readRange[F[_]](path: Path, blocker: Blocker, chunkSize: Int, start: Long, end: Long)(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Byte]
Reads a range of data synchronously from the file at the specified
java.nio.file.Path
.Reads a range of data synchronously from the file at the specified
java.nio.file.Path
.start
is inclusive,end
is exclusive, so whenstart
is 0 andend
is 2, two bytes are read. -
def
size[F[_]](blocker: Blocker, path: Path)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Long]
Returns the size of a file (in bytes).
-
def
tail[F[_]](path: Path, blocker: Blocker, chunkSize: Int, offset: Long = 0L, pollDelay: FiniteDuration = 1.second)(implicit arg0: Sync[F], arg1: ContextShift[F], arg2: Timer[F]): Stream[F, Byte]
Returns an infinite stream of data from the file at the specified path.
Returns an infinite stream of data from the file at the specified path. Starts reading from the specified offset and upon reaching the end of the file, polls every
pollDuration
for additional updates to the file.Read operations are limited to emitting chunks of the specified chunk size but smaller chunks may occur.
If an error occurs while reading from the file, the overall stream fails.
-
def
walk[F[_]](blocker: Blocker, start: Path, maxDepth: Int, options: Seq[FileVisitOption] = Seq.empty)(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Path]
Creates a stream of Paths contained in a given file tree down to a given depth.
-
def
walk[F[_]](blocker: Blocker, start: Path, options: Seq[FileVisitOption])(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Path]
Creates a stream of Paths contained in a given file tree, respecting the supplied options.
Creates a stream of Paths contained in a given file tree, respecting the supplied options. Depth is unlimited.
-
def
walk[F[_]](blocker: Blocker, start: Path)(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Path]
Creates a stream of Paths contained in a given file tree.
Creates a stream of Paths contained in a given file tree. Depth is unlimited.
-
def
watch[F[_]](blocker: Blocker, path: Path, types: Seq[EventType] = Nil, modifiers: Seq[Modifier] = Nil, pollTimeout: FiniteDuration = 1.second)(implicit arg0: Concurrent[F], arg1: ContextShift[F]): Stream[F, Event]
Watches a single path.
Watches a single path.
Alias for creating a watcher and watching the supplied path, releasing the watcher when the resulting stream is finalized.
-
def
watcher[F[_]](blocker: Blocker)(implicit arg0: Concurrent[F], arg1: ContextShift[F]): Resource[F, Watcher[F]]
Creates a Watcher for the default file system.
Creates a Watcher for the default file system.
The watcher is returned as a resource. To use the watcher, lift the resource to a stream, watch or register 1 or more paths, and then return
watcher.events()
. -
def
writeAll[F[_]](path: Path, blocker: Blocker, flags: Seq[StandardOpenOption] = List(StandardOpenOption.CREATE))(implicit arg0: Sync[F], arg1: ContextShift[F]): Pipe[F, Byte, Unit]
Writes all data to the file at the specified
java.nio.file.Path
.Writes all data to the file at the specified
java.nio.file.Path
.Adds the WRITE flag to any other
OpenOption
flags specified. By default, also adds the CREATE flag. -
def
writeRotate[F[_]](computePath: F[Path], limit: Long, blocker: Blocker, flags: Seq[StandardOpenOption] = List(StandardOpenOption.CREATE))(implicit arg0: Concurrent[F], arg1: ContextShift[F]): Pipe[F, Byte, Unit]
Writes all data to a sequence of files, each limited in size to
limit
.Writes all data to a sequence of files, each limited in size to
limit
.The
computePath
operation is used to compute the path of the first file and every subsequent file. Typically, the next file should be determined by analyzing the current state of the filesystem -- e.g., by looking at all files in a directory and generating a unique name. - object FileHandle
- object ReadCursor extends Serializable
- object WriteCursor extends Serializable