Files
smarthash/README.md

33 lines
981 B
Markdown
Raw Normal View History

2016-08-15 04:43:26 +02:00
# nodehash
simplifies access to node hash functions. TypeScript Ready
2016-08-15 05:55:09 +02:00
## Status
[![build status](https://gitlab.com/pushrocks/nodehash/badges/master/build.svg)](https://gitlab.com/pushrocks/nodehash/commits/master)
## Usage
We recommend the use of TypeScript for best in class intellisense.
```typescript
import * as nodehash from "nodehash";
2016-08-16 03:37:40 +02:00
// from stream
2016-08-16 03:41:17 +02:00
let readStream = fs.createReadStream("./somefile.txt")
2016-08-16 03:37:40 +02:00
nodehash.sha256FromStream(readStream)
.then((resultString){
console.log(resultString); // prints hash of the file
});
// from file
nodehash.sha256FromFile("./somefile.txt")
.then((resultString){
console.log(resultString); // prints hash of the file
});
// from string
2016-08-16 03:41:17 +02:00
nodehash.sha256FromString("some weird random string")
2016-08-16 03:37:40 +02:00
.then((resultString){
console.log(resultString); // prints hash of the file
});
2016-08-16 03:41:17 +02:00
let hashString = nodehash.sha256FromStringSync("some weird random string");
2016-08-15 05:55:09 +02:00
```