Curious to give it a try, I downloaded and set it up on my system to try and understand this incredible piece of software.
Setting up QuickJS is dead simple:
- clone one of the Github mirrors with
git clone [email protected]:ldarren/QuickJS.git
…and that’s it: the installation will leave you with a few
interesting binaries, the most interesting one being
the compiler you can use to create executables out of your JS
Trying it out
Let’s try to write a simple script that calculates powersets for a given list:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
then we can compile it down to a binary:
and execute it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
That’s it — quite of a breeze!
Where’s the catch?
Well, QuickJS’ standard library is fairly limited at the moment,
meaning you won’t be able to use most NPM modules or the NodeJS standard
library since it’s not really implemented: QuickJS simply implements
the ES2019 specification, which doesn’t include any kind of standard
item you might be used to, like
The full documentation for QuickJS is available here,
and you will notice that the only standard objects you can work with
os — very limited when compared to other, fully-bloated
engines but useful nevertheless (again, you have to think of QuickJS as an
engine to be embedded, and not something you can use to write your next
Still, quite an impressive piece of work!