I need to use some of the Linux commands in the JavaScript. Is it possible to do that?? If yes what's the syntax for the same??
Daniel DiPaolo
56.6k14 gold badges120 silver badges117 bronze badges
asked Mar 7, 2011 at 16:37
Ambika
3432 gold badges3 silver badges8 bronze badges
-
5Are you talking about browser Javascript or something like node.js or rhino. If you mean browser JS then you can't. If you mean node.js you probably can do this.Zachary K– Zachary K2011年03月07日 16:47:19 +00:00Commented Mar 7, 2011 at 16:47
-
Please be more specific. You want JS on your pages to access the file systems of your users? That simply is not possible, by design.user50049– user500492011年03月08日 12:01:44 +00:00Commented Mar 8, 2011 at 12:01
-
You should definitly find another way to achieve what you need, just because it's like opening your server to the world. At worst you could use ajax calls or SSI or cgi if you need to establish a client-server kind of communication.hornetbzz– hornetbzz2011年03月09日 02:11:11 +00:00Commented Mar 9, 2011 at 2:11
2 Answers 2
In Node.js you can spawn child processes (amongst others: run a linux command) with a child_process.
answered Mar 7, 2011 at 16:54
berkes
27.7k30 gold badges125 silver badges220 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
It's not possible. You can't access the user's (file)system with Javascript because that would be a pretty huge security leak.
answered Mar 7, 2011 at 16:38
dtech
14.2k11 gold badges52 silver badges73 bronze badges
lang-js