FileKit

Simple and expressive file management in Swift

MIT License

Stars
2.3K
Committers
11

Bot releases are hidden (Show)

FileKit - v6.1.0 fix warnings Latest Release

Published by phimage over 1 year ago

Minor update to fix SwiftLint and Xcode warnings

Xcode 14.2 used, minimum OS version updated (ex iOS: 12.0)

FileKit - v5.3.0 SwiftPM

Published by phimage about 5 years ago

SwiftPM compatibility

FileKit - v6.0.0 swift 5

Published by phimage about 5 years ago

Xcode project, SwiftPM, etc.. modified to swift 5 version. No code update.

FileKit - v5.2.0

Published by phimage about 6 years ago

Xcode 10, Swift 4.2 @IgorMuzyka

FileKit - v5.1.0

Published by phimage about 6 years ago

Xcode 9.3, Swift 4.1

FileKit - v5.0.0

Published by phimage about 6 years ago

Xcode 9, Swift 4.0

FileKit - v4.0.1

Published by nvzqz over 7 years ago

FileKit -

Published by nvzqz about 8 years ago

  • swift 3
FileKit - v3.0.0

Published by nvzqz about 8 years ago

Release Notes

This release is mainly to make all current features available.

New Features

  • File system watching
  • Added workingDirectory to Process
  • Added createFile(_:) create(_:) methods to Path and File
  • Added reading and writing for File with NSData type
  • Added grep operations for TextFile
  • Added init(groupIdentifier:) to Path
  • Added additional static paths
  • Added / operator for appending paths
  • Hard linking files

Changes

  • Renamed AllArray and AllNames in FileSystemEventFlags to allFlags and allFlagNames.
  • Changed returned description and debug description strings for FileSystemEventFlags
    • Now contains the name of the type
  • FileSystemEventStream is now private
  • Removed global NSFileManager for Path
    • Each Path instance now has a fileManagerDelegate
  • Expanded name abbreviations
    • "CGD" -> "Dispatch"

Fixes

  • readFromPath for NSData now actually returns the contents
  • Fixed commonAncestor(_:) method for Path
FileKit - v2.0.0

Published by nvzqz almost 9 years ago

Release Notes

Important:

  • The 'FK' prefix for FileKit types has been removed in an effort to make the library less cumbersome and more "Swifty" to use. 🔶
  • FileType is no longer a protocol for files. It is now an enumeration of types that a given file can be. The File class is now the standard form of interacting with files.

New Features

  • FileKit enumeration to get info regarding the current version of FileKit

  • tvOS support 📺

  • DirectoryEnumerator struct to enumerate through the files in a directory.

  • Settable path extension

  • A path's children can now be obtained recursively

    let allFilesInHome = Path.UserHome.children(recursive: true)
    
  • String and Path concatenation with the + operator

  • A changeDirectory(_:) to Path that changes the process' current working
    directory to self

    Path.UserDesktop.changeDirectory {
        print(Path.Current)  // "/Users/nvzqz/Desktop"
    }
    
  • Getting a common ancestor between two paths with the <^> operator and commonAncestor(_:) method

  • Getting a resolved path with the * postfix operator

  • Getting an NSFileHandle for a File or Path

  • Path now conforms to SequenceType

    // Prints all of the paths in the user's home directory
    for path in Path.UserHome {
        print(path)
    }
    
  • Static readFromPath(_:) method for Readable types that returns Self

  • Path now conforms to StringInterpolationConvertible, which acts in the same way regular String interpolation works.

    let filePath: Path = "~/Desktop/File \(2)"
    print(filePath.rawValue)  // "~/Desktop/File 2"
    
  • A find method with a search depth that maps a function on each path found and returns the non-nil results.

    let documents = Path.UserDocuments.find(searchDepth: 1) { String($0) }
    
  • Initializers for NSString and NSBundle that take a Path

  • Getting an NSStream for a File or Path

  • File now conforms to Comparable according to size

  • FilePermissions struct for seeing the permissions of the current process for a given file.

    let swift: Path = "/usr/bin/swift"
    print(swift.filePermissions)  // FilePermissions[Read, Execute]
    

Changes

  • Removed 'FK' prefix from FileKit types in an effort to make the library more Swifty
  • Removed FileType as a protocol for files
    • FileType is now an enumeration of types that a file can be.
    • File is now the standard way of interacting with files
  • Renamed FKError to FileKitError
  • Changed error parameters 'fromPath' and 'toPath' to 'from' and 'to' respectively
  • Changed the • postfix operator to % for standardizing path
  • Renamed findPaths method to find for Path
  • Changed path url property to URL and made it non-optional
  • The find method now has -1 as its default searchDepth
  • writable property for WritableConvertible is now non-optional
  • Fix + operator implementation
FileKit - v1.7.0

Published by nvzqz about 9 years ago

Release Notes

Changes

  • The file manager for FKPath instances is now defined by FKPath.FileManager, which is set to NSFileManager.defaultManager() by default
  • NSDictionary, NSArray, and NSData now conform to FKWritableToFile

New Features

  • message property for FKError that improves error logging
  • FKPath now works with bookmark data
  • FKArrayFile and FKDataFile for NSArray and NSData respectively
  • FKReadableFromFile and FKWritableToFile protocols
  • FKWritableConvertible protocol with writable property to make the conforming type FKWritable
  • Static function FKPath.Volumes(_:) that returns an FKPath array of all mounted volumes
  • touch(_:) method for FKPath that creates a file at the path if it doesn't exist or updates the modification date
  • Properties for checking if the current process has certain privileges for an FKPath (isWritable, isReadable, isExecutable, isDeletable)
FileKit - v1.6.0

Published by nvzqz about 9 years ago

Release Notes

New Features

Support for watchOS 2

FileKit - v1.5.0

Published by nvzqz about 9 years ago

Release Notes

New Features

  • FKPath now has an attributes property and properties for certain attributes
    • creationDate
    • modificationDate
    • ownerName
    • ownerID
    • groupName
    • groupID
    • extensionIsHidden
    • posixPermissions
    • fileReferenceCount
    • fileSize
    • filesystemFileNumber
    • fileType
  • Created FKPath.FileType enum that can also be initialized with a raw value.
    It makes working with the strings returned from the NSFileType key easier to
    work with.
  • FKPath now has an isSymbolicLink property
FileKit - v1.4.0

Published by nvzqz about 9 years ago

Release Notes

Changes

  • The symlink operators have been renamed to =>> and =>!

Fixes

  • The symlinkToPath(_:) method in FKFileType would attempt to symbolically link the argument path to itself rather than the file's path to the argument.
FileKit - v1.3.0

Published by nvzqz about 9 years ago

Release Notes

New Features

  • FKPath now has its own pathExtension property

  • Method for finding paths has been added to FKPath

    You can find all paths with the "txt" extension five folders deep into the Desktop with:

    let textFiles = FKPath.UserDesktop.findPaths(searchDepth: 5) { path in
        path.pathExtension == "txt"
    }
    
FileKit - v1.2.0

Published by nvzqz about 9 years ago

Release Notes

Changes

  • The symlink operators have been renamed to ~>> and ~>!

New Features

  • Except for reading and writing, FKPath now has the same operations as FKFileType
  • Moving files using FKPath or FKFileType (->>, ->!)
  • Copying files using FKPath or FKFileType (+>>, +>!)
FileKit - v1.1.0

Published by nvzqz about 9 years ago

Release Notes

Changes

The components property of FKPath no longer takes into account a trailing
"/" in the path.

let hasTrailing: FKPath = "/Users/"
let noTrailing:  FKPath = "/Users"
print(hasTrailing.components.last == noTrailing.components.last)  // true

New Features

  • exists property for FKPath
  • name property for FKFileType
  • createSymlinkToPath(_:) method for FKPath
  • >>> operator for FKPath symlinks
  • >>! operator for FKPath forced symlinks
FileKit - v1.0.0

Published by nvzqz about 9 years ago

Initial Release

Initial release of FileKit