Packages

p

fs2.io

file

package file

Provides support for working with files.

Source
file.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. file
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait FileHandle[F[_]] extends AnyRef

    Provides the ability to read/write/lock/inspect a file in the effect F.

  2. 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.

  3. 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

  1. 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.

  2. 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.

  3. 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

  4. 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.

  5. 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.

  6. 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.

  7. 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.

  8. 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.

  9. 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.

  10. 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.

  11. 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.

  12. 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 when start is 0 and end is 2, two bytes are read.

  13. def size[F[_]](blocker: Blocker, path: Path)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Long]

    Returns the size of a file (in bytes).

  14. 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.

  15. 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.

  16. 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.

  17. 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.

  18. 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.

  19. 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().

  20. 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.

  21. 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.

  22. object FileHandle
  23. object ReadCursor extends Serializable
  24. object WriteCursor extends Serializable

Deprecated Value Members

  1. object pulls

    Provides various Pulls for working with files.

    Provides various Pulls for working with files.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.1.0) Use ReadCursor/WriteCursor instead

Inherited from AnyRef

Inherited from Any

Ungrouped