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):
- Node.js - Node.js is a platform for easily building fast, scalable network applications.
- ShellJS - Portable Unix shell commands for Node.js