Table of contents

  • Simple Syntax - A quick introduction to /bin/js syntax.
  • How it works - The /bin/js mash-up is achieved by preparsing the script and deciding for each line if it needs to be interpreted as JavaScript or Bash.
  • Arguments to the script - When executing a /bin/js scripts command line arguments are passed to both bash and JavaScript. The arguments to bash are available inthe normal manner and in JavaScript they are available via global variables.
  • Representing Bytes - Node.js represents streams of bytes very efficiently with a class called Buffer. The approach /bin/js takes for streams of bytes is to return JavaScript arrays of integers. Where a single byte would be returned a normal JavaScript integer is returned. The approach /bin/js takes is much simpler, much easier for the user, but much less efficient interms of performance and use of memory.
  • Environment Variables - Environment variables from bash are available in JavaScript via the $.env object.
  • Exceptions - Bash has exception handling limited to returning error codes, JavaScript supports try , catch and finally syntax. /bin/js merges the two providing bash style error return codes and exceptions that can be thrown from bash commands and caught in JavaScript.
  • Features - This page lists the hight level features of /bin/js.
  • Including JavaScript - A preparser directive #include that is very similar to the C directive can be used to execute entire JavaScript files.
  • Job Control - /bin/js has job control from bash, JavaScript is single-threaded, bash suports multiple forked processes.
  • Json - /bin/js has native support for JSON.
  • Magic Vars - /bin/js sets some variable in the global scope at startup that developers should be aware of since they are useful.
  • /bin/js Parser Rules - Full details of the rules used by the preparser preparser defining /bin/js syntax.
  • Style Guide - /bin/js preparser has some quirks that make following a regular style advisable, this page outlines the recommended way to write /bin/js scripts.
  • Xml Support - /bin/js has native support for reading, manipulating and writing XML.
  • API Documentation - Core API docs, Object attribute and method reference.
  • TUI Text User Unterface - TUI contains Objects for commandline uiser interfaces for rending information and fetching input from usersd. TUI is a widget library for the command line.

by teknopaul