README.md (1128B)
1 # Node-yara-rs 2 3 Node-yara-rs is a node module binding for the [yara-rs](https://github.com/Hugal31/yara-rust/) library which in turn does bind to [libyara](https://github.com/VirusTotal/yara). 4 5 ## Installation 6 7 You can install this with npm or yarn as usual: 8 9 ```bash 10 npm install --save @node_yara_rs/node-yara-rs 11 ``` 12 13 ## Usage 14 15 ```typescript 16 // Import the package 17 import { YaraCompiler } from '@node_yara_rs/node-yara-rs' 18 19 // Load your rules as a string or filepaths 20 21 // Create a new compiler which loads a rule (checkout the typings for more details) 22 const compiler = new YaraCompiler([{ 23 string: TEST_RULE 24 }], []); 25 26 // Get a scanner which is used to then scan data 27 const scanner = compiler.newScanner(); 28 29 // Scan some string 30 const result = scanner.scanString("test"); 31 ``` 32 33 Note that most functions here are able to throw if anything fails. Handle these as needed. 34 35 ## Contributing 36 37 Pull requests are welcome. For major changes, please open an issue first 38 to discuss what you would like to change. 39 40 Please make sure to update tests as appropriate. 41 42 ## License 43 44 [Apache-2.0](https://choosealicense.com/licenses/apache-2.0/)