Swift Package Index


A small library to use for your file system.


  • The latest stable release is 1.1.0. Released almost 2 years ago.
  • The last commit to master was almost 2 years ago.

Swift Version Compatibility

  • 1.1.0 and master
    5.3
    5.2
    5.1
    5.0
    4.2
Full build results

Platform Compatibility

  • 1.1.0 and master
    iOS
    macOS(Intel)
    macOS(ARM)
    Linux
    tvOS
    watchOS
Full build results

Francium

Francium is part of the E-sites iOS Suite.


A small library to use for your file system.

forthebadge forthebadge

Platform CocoaPods Compatible Quality Travis-ci

Installation

Podfile:

pod 'Francium'

And then

pod install

Implementation

Both File and Dir implement the following functions / properties:


 /// The absolute path:
/// `File("path: ./").absolutePath #=> /var/folders/6d/FranciumTests-61688042-63CA-4E70-A9A6-31BBBB12FD38/`
public var absolutePath: String 

/// Does the entry exist?
public var isExisting: Bool

/// The base name
/// `File("path: /usr/bin/testfile.swift") #=> testfile.swift`
public var basename: String 

/// The file (or directory) name without the final extension
/// `File("path: testfile.rb").name #=> testfile`
public var name: String

public var isDirectory: Bool 

/// The name of the directory
/// `File("path: testfile.rb").dirname #=> /var/folders/6d`
/// `Dir("path: ./").dirname #=> /var/folders/6d`
public var dirName: String

public var modificationDate: Date?
public var creationDate: Date?

// ---- Path

public func delete() throws
public func rename(to newName: String) throws
public func move(to dir: Dir, newName: String? = nil) throws 
public func copy(to dir: Dir, newName: String? = nil) throws

// ---- Permissions

public func chmod(_ value: Int)

public var permissions: Int?

File

/// The extension name
/// `File("path: testfile.rb").extensionName #=> rb`
public var extensionName: String

public static func create(path: String, permissions: Int = 0o0777) throws -> File
public func create() throws

public func write(data: Data) throws
public func write(string: String) throws
public func append(string: String) throws
public func append(data: Data) throws

public func read() throws -> Data
public var contents: String?

Dir

public static func create(path: String,
                          withIntermediateDirectories: Bool = true,
                          permissions: Int = 0o0777) throws -> Dir

public func make(withIntermediateDirectories: Bool = true) throws

public func glob(_ pattern: String) -> [File]
public func empty(recursively: Bool = true) throws