belaviyo / send-to-vlc

A Webextension to send streamble media sources to VLC (VideoLAN) media player
http://add0n.com/send-to-vlc.html
Mozilla Public License 2.0
131 stars 38 forks source link

Native client requirement #5

Closed skorokithakis closed 6 years ago

skorokithakis commented 6 years ago

This extension seems to require a 60 MB "native client", which I assume is just for receiving a POST and launching a program. Can that not be rewritten in five lines of Go? I'm willing to issue a PR if so.

belaviyo commented 6 years ago

Why 60 MB? The NodeJS executable is around 10M and the source code is like 70 lines! https://github.com/belaviyo/native-client/blob/master/host.js

Install zip file is big as there are two NodeJS executables there (x86, x64)

skorokithakis commented 6 years ago

Ah, I unzipped the zip and saw the cumulative size. Still, I'm not sure that 10 MB is such a small executable. Since it's so small, wouldn't a language like Rust or Go be much more suitable and use almost no memory?

belaviyo commented 6 years ago

There are mainly two things I like about Node:

  1. We are using the official executables (MD5 matching works) so people can trust that the executables are safe
  2. I am using VM (virtual machine) module in NodeJS so that the actual executable is written inside the extension. So basically I transfer the code in string format to the NodeJS and execute it in a VM machine. Whenever there is a bug, I can just fix the extension and there is no need to ask users to install a new native client. Note that it makes the extension more transparent than having an actual executable. Also, my NodeJS implementation requires permission to access low-level APIs.

Since I am not really familiar with these two programming languages, if you think we can have a similar setup, of course, I prefer to have a smaller and more optimized native side code.

belaviyo commented 6 years ago

btw, if you already have the NodeJS executable, the size of installed native would be around 10K as NodeJS executable is not being copied.

skorokithakis commented 6 years ago

Ah, yes, in that case you wouldn't get those benefits, I'm afraid. Thanks for the consideration!