Package

fs2.io

file

Permalink

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

    Permalink

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

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

    To construct a FileHandle, use the methods in the fs2.io.file.pulls object.

  2. final case class ReadCursor[F[_]](file: FileHandle[F], offset: Long) extends Product with Serializable

    Permalink

    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

    Permalink

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

    Permalink
  2. object ReadCursor extends Serializable

    Permalink
  3. object WriteCursor extends Serializable

    Permalink
  4. def copy[F[_]](blocker: Blocker, source: Path, target: Path, flags: Seq[CopyOption] = Seq.empty)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Path]

    Permalink

    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.

  5. def createDirectories[F[_]](blocker: Blocker, path: Path, flags: Seq[FileAttribute[_]] = Seq.empty)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Path]

    Permalink

    Creates a new directory at the given path and creates all nonexistent parent directories beforehand.

  6. def createDirectory[F[_]](blocker: Blocker, path: Path, flags: Seq[FileAttribute[_]] = Seq.empty)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Path]

    Permalink

    Creates a new directory at the given path

  7. def delete[F[_]](blocker: Blocker, path: Path)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Unit]

    Permalink

    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.

  8. def deleteIfExists[F[_]](blocker: Blocker, path: Path)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Boolean]

    Permalink

    Like delete, but will not fail when the path doesn't exist.

  9. def directoryStream[F[_]](blocker: Blocker, path: Path, glob: String)(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Path]

    Permalink

    Creates a stream of Paths inside a directory which match the given glob.

  10. def directoryStream[F[_]](blocker: Blocker, path: Path, filter: (Path) ⇒ Boolean)(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Path]

    Permalink

    Creates a stream of Paths inside a directory, filtering the results by the given predicate.

  11. def directoryStream[F[_]](blocker: Blocker, path: Path)(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Path]

    Permalink

    Creates a stream of Paths inside a directory.

  12. def exists[F[_]](blocker: Blocker, path: Path, flags: Seq[LinkOption] = Seq.empty)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Boolean]

    Permalink

    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.

  13. def move[F[_]](blocker: Blocker, source: Path, target: Path, flags: Seq[CopyOption] = Seq.empty)(implicit arg0: Sync[F], arg1: ContextShift[F]): F[Path]

    Permalink

    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.

  14. def readAll[F[_]](path: Path, blocker: Blocker, chunkSize: Int)(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Byte]

    Permalink

    Reads all data synchronously from the file at the specified java.nio.file.Path.

  15. def readRange[F[_]](path: Path, blocker: Blocker, chunkSize: Int, start: Long, end: Long)(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Byte]

    Permalink

    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.

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

    Permalink

    Returns the size of a file (in bytes).

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

    Permalink

    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.

  18. def walk[F[_]](blocker: Blocker, start: Path, maxDepth: Int, options: Seq[FileVisitOption] = Seq.empty)(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Path]

    Permalink

    Creates a stream of Paths contained in a given file tree down to a given depth.

  19. def walk[F[_]](blocker: Blocker, start: Path, options: Seq[FileVisitOption])(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Path]

    Permalink

    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.

  20. def walk[F[_]](blocker: Blocker, start: Path)(implicit arg0: Sync[F], arg1: ContextShift[F]): Stream[F, Path]

    Permalink

    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.

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

    Permalink

    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.

  22. def watcher[F[_]](blocker: Blocker)(implicit arg0: Concurrent[F], arg1: ContextShift[F]): Resource[F, Watcher[F]]

    Permalink

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

  23. def writeAll[F[_]](path: Path, blocker: Blocker, flags: Seq[StandardOpenOption] = List(StandardOpenOption.CREATE))(implicit arg0: Sync[F], arg1: ContextShift[F]): Pipe[F, Byte, Unit]

    Permalink

    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.

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

    Permalink

    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.

Deprecated Value Members

  1. object pulls

    Permalink

    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