Files
macdown/MacDown/Code/Extension/NSJSONSerialization+File.m
2015-08-15 19:05:43 +08:00

24 lines
582 B
Objective-C

//
// NSJSONSerialization+File.m
// MacDown
//
// Created by Tzu-ping Chung on 15/3.
// Copyright (c) 2015 Tzu-ping Chung . All rights reserved.
//
#import "NSJSONSerialization+File.h"
@implementation NSJSONSerialization (File)
+ (id)JSONObjectWithFileAtURL:(NSURL *)url options:(NSJSONReadingOptions)opt
error:(NSError *__autoreleasing *)error
{
NSInputStream *stream = [NSInputStream inputStreamWithURL:url];
[stream open];
id obj = [self JSONObjectWithStream:stream options:opt error:error];
[stream close];
return obj;
}
@end