File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1
- export function crc32 ( input : Buffer , crc ?: number ) : number
2
- export function crc32c ( input : Buffer , crc ?: number ) : number
1
+ export function crc32 ( input : Buffer | string , crc ?: number ) : number
2
+ export function crc32c ( input : Buffer | string , crc ?: number ) : number
Original file line number Diff line number Diff line change 1
1
const { locateBinding } = require ( '@node-rs/helper' )
2
2
3
- module . exports = require ( locateBinding ( __dirname , 'crc32' ) )
3
+ const binding = require ( locateBinding ( __dirname , 'crc32' ) )
4
+
5
+ module . exports = {
6
+ crc32 : function crc32 ( input , crc ) {
7
+ const _input = Buffer . isBuffer ( input ) ? input : Buffer . from ( input )
8
+ return binding . crc32 ( _input , crc )
9
+ } ,
10
+ crc32c : function crc32c ( input , crc ) {
11
+ const _input = Buffer . isBuffer ( input ) ? input : Buffer . from ( input )
12
+ return binding . crc32c ( _input , crc )
13
+ } ,
14
+ }
You can’t perform that action at this time.
0 commit comments