 import Fuzi
 
 /// Archive completion handler block
-public typealias ArchiveCompletionHandler = (webarchiveData: NSData?, error: ArchiveErrorType?) -> ()
+public typealias ArchiveCompletionHandler = (webarchiveData: NSData?, metaData: [String: String?]?, error: ArchiveErrorType?) -> ()
 
 /// Fetch resource paths completion handler block
-public typealias FetchResourcePathCompletionHandler = (data: NSData?, resources: [String]?, error: ArchiveErrorType?) -> ()
+public typealias FetchResourcePathCompletionHandler = (data: NSData?, metaData: [String: String?]?, resources: [String]?, error: ArchiveErrorType?) -> ()
 
 /// Error type
 public enum ArchiveErrorType: ErrorType {


                do {
                    let webarchiveData = try NSPropertyListSerialization.dataWithPropertyList(webarchive, format: .BinaryFormat_v1_0, options: 0)
                    completionHandler(webarchiveData: webarchiveData, error: nil)
                } catch { error
                    printLog("plist serialize error : \(error)")
                    completionHandler(webarchiveData: nil, error: .PlistSerializeFailed)
                }
            })
        }

     */
    public static func archiveWebpageFormUrl(url: NSURL, completionHandler: ArchiveCompletionHandler) {

        self.resourcePathsFromUrl(url, fetchOptions: defaultFetchOptions) { (data, metaData, resources, error) in
            guard let resources = resources else {
                printLog("resource fetch error : \(error)")
                completionHandler(webarchiveData: nil, metaData: nil, error: .FetchResourceFailed)
                return
            }
            
            let resourceInfo = NSMutableDictionary(capacity: resources.count)

            let assembleQueue = dispatch_queue_create(kResourceAssembleQueue, nil)
