Repository navigation
feat: expose text media through Node API - #13
Merged
Merged
Conversation
Expose text processing with optional media and process options through the Node-API addon.
There was a problem hiding this comment.
Pull request overview
Adds a missing Node-API binding in ffi/node/addon.cpp so Node consumers can call the existing public C API entrypoint for processing text with optional attached “source media” and JSON options.
Changes:
- Introduces
ProcessTextWithMediaJSONNode callback to invokecortext_process_text_with_media_json_with_options. - Wires the new callback into the exported instance method table as
processTextWithMediaJson.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+593
to
+611
| cortext_media media{}; | ||
| const cortext_media *media_ptr = nullptr; | ||
| if (argc >= 3 && !IsNullOrUndefined (env, args[2])) | ||
| { | ||
| if (!GetUint8Data (env, args[2], &media_data, media_size)) | ||
| { | ||
| return ThrowTypeError (env, "media must be bytes, null, or undefined"); | ||
| } | ||
| if (argc >= 4 && !IsNullOrUndefined (env, args[3]) | ||
| && !GetString (env, args[3], media_mimetype)) | ||
| { | ||
| return ThrowTypeError (env, "mediaMimeType must be a string"); | ||
| } | ||
| media = cortext_media{ media_data, media_size, | ||
| media_mimetype.empty () | ||
| ? nullptr | ||
| : media_mimetype.c_str () }; | ||
| media_ptr = &media; | ||
| } |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the missing Node-API bridge for the already-public text-media C API.
processTextWithMediaJsonfromffi/node/addon.cpp.Focused source diff check passes. No release tag or merge performed.