Skip to content

Commit

Permalink
fix(bindings/nodejs): add type annotation for stream (#539)
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc authored Dec 17, 2024
1 parent 460890c commit 2c5e085
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bindings/nodejs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ export declare class RowIterator {
* Returns `None` if there are no more rows.
*/
next(): Promise<Error | Row | null>
/**
* Return a Readable Stream for the query result.
* Should be used with `ObjectMode` set to `true`.
*/
stream(): import('stream').Readable
}
export declare class RowIteratorExt {
schema(): Schema
Expand Down
7 changes: 7 additions & 0 deletions bindings/nodejs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,13 @@ impl RowIterator {
.map_err(format_napi_error)
})
}

/// Return a Readable Stream for the query result.
/// Should be used with `ObjectMode` set to `true`.
#[napi(ts_return_type = "import('stream').Readable")]
pub fn stream(&self) -> () {
unreachable!()
}
}

#[napi]
Expand Down

0 comments on commit 2c5e085

Please sign in to comment.