## logCaptureSuccess archive.social **Author**: The Harvard Library Innovation Lab **License**: MIT * [logCaptureSuccess](#utils.module_logCaptureSuccess) * [.SuccessLog](#utils.module_logCaptureSuccess.SuccessLog) * [new exports.SuccessLog()](#new_utils.module_logCaptureSuccess.SuccessLog_new) * [.filepath](#utils.module_logCaptureSuccess.SuccessLog+filepath) : string * [.add(accessKey, pdfBytes)](#utils.module_logCaptureSuccess.SuccessLog+add) * [.findHashInLogs(hash)](#utils.module_logCaptureSuccess.SuccessLog+findHashInLogs) ⇒ boolean * [.reset()](#utils.module_logCaptureSuccess.SuccessLog+reset) ⇒ void ### logCaptureSuccess.SuccessLog **Kind**: static class of [logCaptureSuccess](#utils.module_logCaptureSuccess) * [.SuccessLog](#utils.module_logCaptureSuccess.SuccessLog) * [new exports.SuccessLog()](#new_utils.module_logCaptureSuccess.SuccessLog_new) * [.filepath](#utils.module_logCaptureSuccess.SuccessLog+filepath) : string * [.add(accessKey, pdfBytes)](#utils.module_logCaptureSuccess.SuccessLog+add) * [.findHashInLogs(hash)](#utils.module_logCaptureSuccess.SuccessLog+findHashInLogs) ⇒ boolean * [.reset()](#utils.module_logCaptureSuccess.SuccessLog+reset) ⇒ void #### new exports.SuccessLog() On init: - Create log file if it doesn't exist - Load hashes from file into `this.#hashes`. #### successLog.filepath : string Complete path to `success-log.json`. **Kind**: instance property of [SuccessLog](#utils.module_logCaptureSuccess.SuccessLog) #### successLog.add(accessKey, pdfBytes) Calculates hash of a PDF an: - Creates a success log entry - Updates `this.#hashes` (so it doesn't need to reload from file) **Kind**: instance method of [SuccessLog](#utils.module_logCaptureSuccess.SuccessLog) | Param | Type | Description | | --- | --- | --- | | accessKey | string | | | pdfBytes | Buffer | Used to store a SHA512 hash of the PDF that was delivered | #### successLog.findHashInLogs(hash) ⇒ boolean Checks whether or not a given hash is present in the logs. **Kind**: instance method of [SuccessLog](#utils.module_logCaptureSuccess.SuccessLog) | Param | Type | | --- | --- | | hash | string | #### successLog.reset() ⇒ void Resets `success-log.json`. Also clears `this.#hashes`. **Kind**: instance method of [SuccessLog](#utils.module_logCaptureSuccess.SuccessLog)