kopia lustrzana https://github.com/harvard-lil/archive.social
3.0 KiB
3.0 KiB
logCaptureSuccess
archive.social
Author: The Harvard Library Innovation Lab
License: MIT
- logCaptureSuccess
- .SuccessLog
- new exports.SuccessLog()
- .filepath :
string
- .add(accessKey, pdfBytes)
- .findHashInLogs(hash) ⇒
boolean
- .reset() ⇒
void
- .SuccessLog
logCaptureSuccess.SuccessLog
Kind: static class of logCaptureSuccess
- .SuccessLog
- new exports.SuccessLog()
- .filepath :
string
- .add(accessKey, pdfBytes)
- .findHashInLogs(hash) ⇒
boolean
- .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
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
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
Param | Type |
---|---|
hash | string |
successLog.reset() ⇒ void
Resets success-log.json
.
Also clears this.#hashes
.
Kind: instance method of SuccessLog