Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # Sumchecker
  2. [![Travis CI](https://travis-ci.org/malept/sumchecker.svg?branch=master)](https://travis-ci.org/malept/sumchecker)
  3. [![AppVeyor CI](https://ci.appveyor.com/api/projects/status/wm4n2r11nlff8ify?svg=true)](https://ci.appveyor.com/project/malept/sumchecker)
  4. [![Code Coverage](https://codecov.io/gh/malept/sumchecker/branch/master/graph/badge.svg)](https://codecov.io/gh/malept/sumchecker)
  5. ![Dependency Status](https://tidelift.com/badges/github/malept/sumchecker)
  6. Sumchecker is a pure Node.js solution to validating files specified in a checksum file, which are
  7. usually generated by programs such as [`sha256sum`](https://en.wikipedia.org/wiki/Sha256sum).
  8. ## Usage
  9. ```javascript
  10. const sumchecker = require('sumchecker');
  11. try {
  12. await sumchecker(algorithm, checksumFilename, baseDir, filesToCheck);
  13. console.log('All files validate!');
  14. } catch (error) {
  15. console.error('An error occurred', error);
  16. }
  17. ```
  18. Returns a [`Promise`]. The promise is resolved when all files specified in
  19. [`filesToCheck`](#filesToCheck) are validated. The promise is rejected otherwise.
  20. ### Parameters
  21. #### `algorithm`
  22. `String` - The hash algorithm used in [`checksumFilename`](#checksumFilename). Corresponds to the
  23. algorithms allowed by [`crypto.createHash()`].
  24. #### `checksumFilename`
  25. `String` - The path to the checksum file.
  26. #### `baseDir`
  27. `String` - The base directory for the files specified in [`filesToCheck`](#filesToCheck).
  28. #### `filesToCheck`
  29. `Array` or `String` - one or more paths of the files that will be validated, relative to
  30. [`baseDir`](#baseDir).
  31. ### Errors
  32. These are `sumchecker`-specific error classes that are passed to the promise's reject callback.
  33. #### `sumchecker.ChecksumMismatchError`
  34. When at least one of the files does not match its expected checksum.
  35. Properties:
  36. * `filename` (`String`) - a path to a file that did not match
  37. #### `sumchecker.ChecksumParseError`
  38. When the checksum file cannot be parsed (as in, it does not match the checksum file format).
  39. Properties:
  40. * `lineNumber` (`Number`) - the line number that could not be parsed
  41. * `line` (`String`) - the raw line data that could not be parsed, sans newline
  42. #### `sumchecker.NoChecksumFoundError`
  43. When at least one of the files specified to check is not listed in the checksum file.
  44. Properties:
  45. * `filename` (`String`) - a filename from [`filesToCheck`](#filesToCheck)
  46. ## Support
  47. [Get supported sumchecker with the Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-sumchecker?utm_source=npm-sumchecker&utm_medium=referral&utm_campaign=readme).
  48. ## Security contact information
  49. To report a security vulnerability, please use the [Tidelift security
  50. contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
  51. ## Legal
  52. This library is copyrighted under the terms of the [Apache 2.0 License].
  53. [`crypto.createHash()`]: https://nodejs.org/dist/latest-v4.x/docs/api/crypto.html#crypto_crypto_createhash_algorithm
  54. [`Promise`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
  55. [Apache 2.0 License]: http://www.apache.org/licenses/LICENSE-2.0