Francium 1.1.0

Francium 1.1.0

Bas van Kuijck 管理。



Francium 1.1.0

  • Bas van Kuijck

Francium

E-sites iOS Suite 的一部分。


用于文件系统的一个小型库。

forthebadge forthebadge

Platform CocoaPods Compatible Quality Travis-ci

安装

Podfile

pod 'Francium'

然后

pod install

实现

FileDir 实现以下函数/属性

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