I would like to try out an AES encryption facility: https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js But without using a browser, with a command line tool, if it exists at all. Which can import this aes.js file, and I can call the different functions from a REPL, or just interpreting a script which utilizes this aes library, and gives output on STDOUT - without a browser.


Node can do this. Download the file to a local ./aes.js or something, and then start node prompt and:

> .load aes.js


Unless by 'or' you mean that you need both to be able to use in from a REPL and import it from a script. I don't know if it's possible to import unexported names from another file (the special .load command-line thing seems to dump the code into the current scope). But if you can access the source of the library instead of the bundle or install it with NPM, you should be able to import it with const CryptoJS = require('crypto-js') (cause node needs module.exports to be used in order to import names from it).


Mozilla developers had the exact same idea, and there is a page in their docs about this:


The following is copied from there (source page last updated Aug 19, 2021):

Standalone JavaScript shells

The following JavaScript shells are stand-alone environments, like Perl or Python.

  • Node.js - Node.js is a platform for easily building fast, scalable network applications.
  • GraalJS - A high performance implementation of the JavaScript programming language. Built on the GraalVM by Oracle Labs.
  • ShellJS - Portable Unix shell commands for Node.js

List of JavaScript shells

The following JavaScript shells work with Mozilla.

  • 1
    Nothing to add that justifies a standalone answer, but this "ECMAScript 2016+ compatibility table" shows an elaborate comparison of the different engines with respect to standards and compatibility.
    – knb
    Nov 18 '21 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.