Packages

trait Files[F[_]] extends SyncFiles[F]

Provides operations related to working with files in the effect F.

An instance is available for any effect F which has an Async[F] instance.

Source
Files.scala
Linear Supertypes
SyncFiles[F], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Files
  2. SyncFiles
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def copy(source: Path, target: Path, flags: Seq[CopyOption] = Seq.empty): 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.

    Definition Classes
    SyncFiles
  2. abstract def createDirectories(path: Path, flags: Seq[FileAttribute[_]] = Seq.empty): F[Path]

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

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

    Definition Classes
    SyncFiles
  3. abstract def createDirectory(path: Path, flags: Seq[FileAttribute[_]] = Seq.empty): F[Path]

    Creates a new directory at the given path.

    Creates a new directory at the given path.

    Definition Classes
    SyncFiles
  4. abstract def delete(path: Path): F[Unit]

    Deletes a file.

    Deletes a file.

    If the file is a directory then the directory must be empty for this action to succeed. This action will fail if the path doesn't exist.

    Definition Classes
    SyncFiles
  5. abstract def deleteDirectoryRecursively(path: Path, options: Set[FileVisitOption] = Set.empty): F[Unit]

    Recursively delete a directory

    Recursively delete a directory

    Definition Classes
    SyncFiles
  6. abstract def deleteIfExists(path: Path): F[Boolean]

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

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

    Definition Classes
    SyncFiles
  7. abstract def directoryStream(path: Path, glob: String): Stream[F, Path]

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

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

    Definition Classes
    SyncFiles
  8. abstract def directoryStream(path: Path, filter: (Path) => Boolean): Stream[F, Path]

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

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

    Definition Classes
    SyncFiles
  9. abstract def directoryStream(path: Path): Stream[F, Path]

    Creates a stream of Paths inside a directory.

    Creates a stream of Paths inside a directory.

    Definition Classes
    SyncFiles
  10. abstract def exists(path: Path, flags: Seq[LinkOption] = Seq.empty): 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.

    Definition Classes
    SyncFiles
  11. abstract def isDirectory(path: Path, linkOption: Seq[LinkOption] = Nil): F[Boolean]

    Tests whether a file is a directory.

    Tests whether a file is a directory.

    The options sequence may be used to indicate how symbolic links are handled for the case that the file is a symbolic link. By default, symbolic links are followed and the file attribute of the final target of the link is read. If the option NOFOLLOW_LINKS is present then symbolic links are not followed.

    Where is it required to distinguish an I/O exception from the case that the file is not a directory then the file attributes can be read with the readAttributes method and the file type tested with the BasicFileAttributes.isDirectory() method.

    path

    the path to the file to test

    returns

    true if the file is a directory; false if the file does not exist, is not a directory, or it cannot be determined if the file is a directory or not.

    Definition Classes
    SyncFiles
  12. abstract def isFile(path: Path, linkOption: Seq[LinkOption] = Nil): F[Boolean]

    Tests whether a file is a regular file with opaque content.

    Tests whether a file is a regular file with opaque content.

    The options sequence may be used to indicate how symbolic links are handled for the case that the file is a symbolic link. By default, symbolic links are followed and the file attribute of the final target of the link is read. If the option NOFOLLOW_LINKS is present then symbolic links are not followed.

    Where is it required to distinguish an I/O exception from the case that the file is not a regular file then the file attributes can be read with the readAttributes method and the file type tested with the BasicFileAttributes.isRegularFile() method.

    path

    the path to the file

    returns

    true if the file is a regular file; false if the file does not exist, is not a regular file, or it cannot be determined if the file is a regular file or not.

    Definition Classes
    SyncFiles
  13. abstract def move(source: Path, target: Path, flags: Seq[CopyOption] = Seq.empty): 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.

    Definition Classes
    SyncFiles
  14. abstract def open(path: Path, flags: Seq[OpenOption]): Resource[F, FileHandle[F]]

    Creates a FileHandle for the file at the supplied Path.

    Creates a FileHandle for the file at the supplied Path.

    Definition Classes
    SyncFiles
  15. abstract def openFileChannel(channel: F[FileChannel]): Resource[F, FileHandle[F]]

    Creates a FileHandle for the supplied FileChannel.

    Creates a FileHandle for the supplied FileChannel.

    Definition Classes
    SyncFiles
  16. abstract def permissions(path: Path, flags: Seq[LinkOption] = Seq.empty): F[Set[PosixFilePermission]]

    Get file permissions as set of PosixFilePermission.

    Get file permissions as set of PosixFilePermission.

    Note: this will only work for POSIX supporting file systems.

    Definition Classes
    SyncFiles
  17. abstract def readAll(path: Path, chunkSize: Int): Stream[F, Byte]

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

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

    Definition Classes
    SyncFiles
  18. abstract def readCursor(path: Path, flags: Seq[OpenOption] = Nil): Resource[F, ReadCursor[F]]

    Returns a ReadCursor for the specified path.

    Returns a ReadCursor for the specified path. The READ option is added to the supplied flags.

    Definition Classes
    SyncFiles
  19. abstract def readRange(path: Path, chunkSize: Int, start: Long, end: Long): 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.

    Definition Classes
    SyncFiles
  20. abstract def setPermissions(path: Path, permissions: Set[PosixFilePermission]): F[Path]

    Set file permissions from set of PosixFilePermission.

    Set file permissions from set of PosixFilePermission.

    Note: this will only work for POSIX supporting file systems.

    Definition Classes
    SyncFiles
  21. abstract def size(path: Path): F[Long]

    Returns the size of a file (in bytes).

    Returns the size of a file (in bytes).

    Definition Classes
    SyncFiles
  22. abstract def tail(path: Path, chunkSize: Int, offset: Long = 0L, pollDelay: FiniteDuration = 1.second): 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.

  23. abstract def tempDirectory(dir: Option[Path] = None, prefix: String = "", attributes: Seq[FileAttribute[_]] = Seq.empty): Resource[F, Path]

    Creates a Resource which can be used to create a temporary directory.

    Creates a Resource which can be used to create a temporary directory. The directory is created during resource allocation, and removed during its release.

    dir

    the directory which the temporary directory will be created in. Pass in None to use the default system temp directory

    prefix

    the prefix string to be used in generating the directory's name

    attributes

    an optional list of file attributes to set atomically when creating the directory

    returns

    a resource containing the path of the temporary directory

    Definition Classes
    SyncFiles
  24. abstract def tempFile(dir: Option[Path] = None, prefix: String = "", suffix: String = ".tmp", attributes: Seq[FileAttribute[_]] = Seq.empty): Resource[F, Path]

    Creates a Resource which can be used to create a temporary file.

    Creates a Resource which can be used to create a temporary file. The file is created during resource allocation, and removed during its release.

    dir

    the directory which the temporary file will be created in. Pass in None to use the default system temp directory

    prefix

    the prefix string to be used in generating the file's name

    suffix

    the suffix string to be used in generating the file's name

    attributes

    an optional list of file attributes to set atomically when creating the file

    returns

    a resource containing the path of the temporary file

    Definition Classes
    SyncFiles
  25. abstract def walk(start: Path, maxDepth: Int, options: Seq[FileVisitOption] = Seq.empty): Stream[F, Path]

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

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

    Definition Classes
    SyncFiles
  26. abstract def walk(start: Path, options: Seq[FileVisitOption]): 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.

    Definition Classes
    SyncFiles
  27. abstract def walk(start: Path): 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.

    Definition Classes
    SyncFiles
  28. abstract def watch(path: Path, types: Seq[EventType] = Nil, modifiers: Seq[Modifier] = Nil, pollTimeout: FiniteDuration = 1.second): 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.

  29. abstract def watcher: 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().

  30. abstract def writeAll(path: Path, flags: Seq[StandardOpenOption] = List(StandardOpenOption.CREATE)): Pipe[F, Byte, INothing]

    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.

    Definition Classes
    SyncFiles
  31. abstract def writeCursor(path: Path, flags: Seq[OpenOption] = List(StandardOpenOption.CREATE)): Resource[F, WriteCursor[F]]

    Returns a WriteCursor for the specified path.

    Returns a WriteCursor for the specified path.

    The WRITE option is added to the supplied flags. If the APPEND option is present in flags, the offset is initialized to the current size of the file.

    Definition Classes
    SyncFiles
  32. abstract def writeCursorFromFileHandle(file: FileHandle[F], append: Boolean): F[WriteCursor[F]]

    Returns a WriteCursor for the specified file handle.

    Returns a WriteCursor for the specified file handle.

    If append is true, the offset is initialized to the current size of the file.

    Definition Classes
    SyncFiles
  33. abstract def writeRotate(computePath: F[Path], limit: Long, flags: Seq[StandardOpenOption] = List(StandardOpenOption.CREATE)): Pipe[F, Byte, INothing]

    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.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  15. def toString(): String
    Definition Classes
    AnyRef → Any
  16. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  17. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from SyncFiles[F]

Inherited from AnyRef

Inherited from Any

Ungrouped