Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why is the recommended javascript way of doing it

    var fso = new ActiveXObject("Scripting.FileSystemObject");
rather than

    var fs = require('fs') // (or the appropriate ES6 incantation)

?


The latter is not "javascript" in general, it's just a Node.js (a specific v8 Javascript runtime + native integration and libs like fs bundle) API.

And the former windows version is JScript which is an implementation Javascript just using an different name for trademark reasons, but tied to an old version of the JavaScript standard (which is confusingly called "ecmascript" officially), plus some Windows-specific integrations, like ActiveXObject and COM/OLE support.

(There's also a later .NET version of JScript to add to the confusion).


It’s JScript. Not JavaScript and definitely not Node.JS


Because JScript was introduced back in Windows 98 and the modern APIs were introduced 10 years later (in the case of Node.js).


Windows doesn't ship with node.js.


Because it’s JScript, which was abandoned prior to ES6.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: