Latest 0.0.3
Homepage https://github.com/ShengHuaWu/SHFile
License MIT
Platforms ios 8.0, requires ARC
Authors

The main purpose of this project is to preserve data in the local directory.

However, SHFile is an abstract class, please use its subclass instead.
One subclass SHTemporaryFile is used to store data in the temporary directory,
and the other subclass SHDocumentsFile is used to save data in the documents directory.

Usage

  • The following example is only related to SHTemporaryFile class,
    and the usage of SHDocumentsFile is quite similar.

First of all, invoke the set-up method,
and AppDelegate is a proper place to call the set-up method.

[SHTemporaryFile setUp];

Create a file by a given name and data,
and save the data in the temporary directory.

NSData *data = ...;
SHTemporaryFile *file = [SHTemporaryFile fileWithName:@"filename.txt" data:data];
NSError *error = nil;
[file saveData:&error];

Retrieve the data from the temporary directory.

NSData *data = [file retrieveData];
// ... Do something with the data.

Delete the data in the temporary directory.

[file deleteData:&error];

Clean up the temporary directory.

[SHTemporaryFile cleanUp];

It’s also possible to save (delete) multiple files at once.

NSArray *files; // An array contains several SHTemporaryFile instances.
NSError *error = nil;
[SHTemporaryFile saveAll:files error:&error];

Latest podspec

{
    "name": "SHFile",
    "version": "0.0.3",
    "summary": "Preserve data in the local directory.",
    "description": "SHFile is created for storing data in the local directory.ntt    However, it's an abstract class, please use its subclass instead.n                    One subclass SHTemporaryFile is used to store data in the temporary directory,n                    and the other subclass SHDocumentsFile is used to save data in the documents directory.",
    "homepage": "https://github.com/ShengHuaWu/SHFile",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "ShengHua Wu": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/ShengHuaWu/SHFile.git",
        "tag": "0.0.3"
    },
    "source_files": "SHFile/Classes/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This