laniakea
Version:
A renaming utility for classic ROMs
83 lines (58 loc) • 1.82 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: crypto.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: crypto.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>const fs = require('fs');
const crypto = require('crypto');
module.exports = {
/**
* Returns an MD5Checksum of a given file
* @param {string} filepath - Where the file to be renamed is located. Should be a fullpath.
* @return {string} - The checksum of the given file
*/
MD5Checksum(filepath) {
const BUFFER_SIZE = 8192;
var fd = fs.openSync(filepath, 'r');
var hash = crypto.createHash('md5');
var buffer = new Buffer(BUFFER_SIZE);
try {
var bytesRead;
do {
bytesRead = fs.readSync(fd, buffer, 0, BUFFER_SIZE);
hash.update(buffer.slice(0, bytesRead));
} while (bytesRead === BUFFER_SIZE);
} finally {
fs.closeSync(fd);
}
return hash.digest('hex');
}
};
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Tue Feb 28 2017 19:33:36 GMT-0800 (PST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>