GithubHelp home page GithubHelp logo

ayfile's Introduction

AYFile

CI Status Version License Platform

引用

  使用CocoaPods可以很方便地引入AYFile。Podfile添加AYFile的依赖。

pod "AYFile"

简介

  你是否厌倦了写一长串代码来获取Documents目录?你是否厌倦了NSFileManager那一大串复杂又难记又难打的api?很好,你现在可以用AYFile了。因为它足够简单,但功能却不简单。

  AYFile简单地封装了AYFileManager的一些功能,用于支持快速管理文件和目录。

用法

  AYFile的头文件中,已经为每个方法做上了注释,看了注释之后便可以了解它的用法了。

使用用例:

   //获取Documents目录
   [AYFile documents];
   
   //在Documents目录下创建Users/Caches/Files目录
   [[[[[AYFile documents] child:@"Users"] child:@"Caches"] child:@"Files"] mkDirs];
   
   //获取Documents/Users/Database/workflows.db文件路径
   //仅仅只是获取路径,尽管Database目录还没有创建
   NSString *filePath = [[[[[AYFile documents] child:@"Users"] child:@"Database"] child:@"workflows.db"].path;
   
   //清空Library/Caches目录
   [[AYFile caches] clear];
   
   //删除Document/Users目录(子目录和文件都会被删掉)
   [[[AYFile documents] child:@"Users"] delete];
   
   //获取目录下所有文件和文件夹
   NSArray<AYFile *> *files = [[AYFile documents] childs];
   
   //获取文件或文件夹(递归计算)大小
   long long folderSize = [[[AYFile documents] child:@"Users"] child:@"Caches"].size;
   
   //判断是文件夹还是文件
   //NO
   BOOL isDocument = [[[[[[AYFile documents] child:@"Users"] child:@"Database"] child:@"workflows.db"] isDocument];
   //YES
   BOOL isDocument = [AYFile documents].isDocument;

License

AYFile is available under the MIT license. See the LICENSE file for more info.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.