A NodeJS library designed to process local file size strings and hash a file. As of now fileside can only process local files but look to expand to additional features such as drag and drop support.
This Node.JS module analyzes a local file and returns the following information:
- Filesize in kilobytes
- Filesize in Bytes
- Hash using md5, sha1, sha256, sha512
The following demonstrates different uses of fileside's functions and instructions to get you setup for development and testing.
var fileside = require("fileside");
var testFile = "./test/test_file.txt";
fileside.handleFile(testFile);
fileside.getFileKb(testFile, function(err, result) {
console.log(result); //0.04 Kilobytes
});
fileside.getFileBytes(testFile, function(err, result) {
console.log(result);
}); //43 Bytes
fileside.fileHash(testFile, "md5", function(err, result) {
console.log("md5: " + result);
}); //md5: 9e107d9d372bb6826bd81d3542a419d6
fileside.fileHash(testFile, "sha1", function(err, result) {
console.log("sha1: " + result);
}); //sha1: 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12
fileside.fileHash(testFile, "sha256", function(err, result) {
console.log("sha256: " + result);
}); //sha256: d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592
fileside.fileHash(testFile, "sha512", function(err, result) {
console.log("sha512: " + result);
}); //07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb642e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6
- node v8.9 and up
- npm 5.5 and up
npm install fileside
Setup fileside on your local machine
git clone https://github.com/marcobeltempo/fileside
cd fileside
npm install
npm start
// nodemon automatically rebuilds/restarts the server whenever a change is made- Navigate to http://localhost:3000/ to view the results
npm start
- localhost server displays the results oftest_file.txt
npm test
- performs an eslint + prettier and jest testsnpm run test:lint:fix
- automatically fix any styling and validation errors. (Double check your changes)
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- Marco Beltempo - Initial work - fileside
See the list of contributors who have participated in this project.
This project is licensed under the BSD 2-Clause License - see the LICENSE.md file for details