smarthash/README.md

33 lines
981 B
Markdown
Raw Normal View History

2016-08-15 02:43:26 +00:00
# nodehash
simplifies access to node hash functions. TypeScript Ready
2016-08-15 03:55:09 +00: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 01:37:40 +00:00
// from stream
2016-08-16 01:41:17 +00:00
let readStream = fs.createReadStream("./somefile.txt")
2016-08-16 01:37:40 +00: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 01:41:17 +00:00
nodehash.sha256FromString("some weird random string")
2016-08-16 01:37:40 +00:00
.then((resultString){
console.log(resultString); // prints hash of the file
});
2016-08-16 01:41:17 +00:00
let hashString = nodehash.sha256FromStringSync("some weird random string");
2016-08-15 03:55:09 +00:00
```