I know. Node.js is to bloated to justify using other than for preference.
And there is no way that I am aware of to build `node` executable with only
standard JavaScript implementation, Process, File system modules
https://github.com/guest271314/native-messaging-nodejs/blob/main/nm_nodejs.js
- without all the bloat.

I must test and ask if the requirement is possible before abandoning the
concept. It should be possible.

This is what I have so far, which exits early without sending the message
to client.

d8.js
    #!/usr/bin/env -S ./d8 --enable-os-system --experimental-web-snapshots
./test.js

test.js
    const json = JSON.stringify("test");
    let header = Uint32Array.from({
       length: 4,
     }, (_, index) => (json.length >> (index * 8)) & 0xff
    );
    let output = new Uint8Array(header.length + json.length);
    output.set(header, 0);
    write(JSON.stringify(header));
    write(json);

On Sat, Oct 22, 2022 at 2:11 PM Ben Noordhuis <i...@bnoordhuis.nl> wrote:

> On Sat, Oct 22, 2022 at 4:09 PM guest271314 <guest271...@gmail.com> wrote:
> >
> > I have implemented Native Messaging hosts using QuickJS, Deno, and
> Node.js where it is possible to read stdin and write to stdout.
> >
> > How would you go about implementing a Native Messaging host using d8?
>
> I probably wouldn't. :-)
>
> d8 exists to power V8's test suite. It's not really intended as a
> standalone application.
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "v8-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/v8-users/ZCE_WMSBBHs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> v8-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/v8-users/CAHQurc_XkTm2ODVwg79qEOCLmo6uEdoTJnxZf_VB6-51A7rY2A%40mail.gmail.com
> .
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/CA%2BsyWAMeStbQ5jyS89aN4k_nHMHRf69iSZc%2Bx47qbTw4Qaon%3DQ%40mail.gmail.com.

Reply via email to