简体   繁体   English

当文件托管在服务器上时,是否可以使用节点启动脚本?

[英]Is it possible to launch a script using node while the files are hosted on a server?

Not sure if this exact question has come up before because no matter what I can't find the correct wording for my situation.不确定之前是否出现过这个确切的问题,因为无论如何我都找不到适合我情况的正确措辞。

I have a folder on my desktop called "Script".我的桌面上有一个名为“Script”的文件夹。 Inside this folder I have a bunch of different files and folders.在这个文件夹中,我有一堆不同的文件和文件夹。

I also have a .bat file that says:我还有一个 .bat 文件,上面写着:

cd "C:/Users/Name/Desktop/Script/"
node file.js

inside of it.在它里面。 All this does is execute the file using node.所有这些都是使用 node.js 执行文件。

Now here's my problem, I want other people to be able to launch this script as well without giving them all the files.现在这是我的问题,我希望其他人也能够在不提供所有文件的情况下启动此脚本。 I can't have them see the source code for the script.我不能让他们看到脚本的源代码。

So I was wondering if I uploaded the entire folder to my web host, is there a possible way for a command like所以我想知道我是否将整个文件夹上传到我的网络主机,是否有可能的方法来执行类似的命令

cd "websitehostname.com/files/"
node file.js

and then the script would execute on their computer just as it was on mine?然后脚本会像在我的计算机上一样在他们的计算机上执行吗? Or is this not possible.或者这是不可能的。

Had a similar problem.有类似的问题。

If not letting people see the source code is the necessity.如果不让人们看到源代码是必须的。 I would rather suggest you compile an uglified/obfuscated version of the source code and then send it across to people.我宁愿建议您编译一个丑陋/混淆的源代码版本,然后将其发送给人们。

You could understand more about code obfuscation here您可以 在此处了解有关代码混淆的更多信息

Most of the websites do the same.大多数网站都这样做。

You could even compile your source code into native code using Enclose JS library您甚至可以使用Enclose JS源代码编译为本机代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM