| 379 | } |
| 380 | |
| 381 | napi_value hasherUpdate(napi_env env, napi_callback_info info) { |
| 382 | size_t argc = 1; |
| 383 | napi_value args[1]; |
| 384 | napi_value js_this; |
| 385 | napi_get_cb_info(env, info, &argc, args, &js_this, NULL); |
| 386 | |
| 387 | hasher_t *hasher; |
| 388 | napi_unwrap(env, js_this, (void **)&hasher); |
| 389 | |
| 390 | void *buffer_data; |
| 391 | size_t buffer_length; |
| 392 | napi_status status = napi_get_buffer_info(env, args[0], &buffer_data, &buffer_length); |
| 393 | if (status != napi_ok) { |
| 394 | napi_throw_error(env, NULL, "Argument must be a Buffer"); |
| 395 | return NULL; |
| 396 | } |
| 397 | |
| 398 | sz_hash_state_update(&hasher->state, (sz_cptr_t)buffer_data, buffer_length); |
| 399 | return js_this; |
| 400 | } |
| 401 | |
| 402 | napi_value hasherDigest(napi_env env, napi_callback_info info) { |
| 403 | napi_value js_this; |
nothing calls this directly
no test coverage detected
searching dependent graphs…