[joox] docs #1: improve joox method docs

This commit is contained in:
鲁树人 2024-09-17 21:48:14 +01:00
parent 12199616c2
commit 2556d04120

View File

@ -16,11 +16,14 @@ impl JsJooxFile {
))
}
/// Get the buffer size to allocate for decrypt method.
#[wasm_bindgen(getter, js_name = "bufferLength")]
pub fn get_buffer_size(&self) -> usize {
self.0.get_audio_block_size()
}
/// Decrypt a given block of buffer (see {@link bufferLength})
/// Return the length of decrypted & unpadded data from the input buffer.
#[wasm_bindgen(js_name = "decrypt")]
pub fn decrypt(&self, buffer: &mut [u8]) -> Result<usize, JsError> {
let decrypted = self.0.decrypt_audio_block(buffer).map_err(JsError::from)?;