All Projects → lipp → nodish

lipp / nodish

Licence: MIT license
A Lightweight Lua equivalent to Node.js

Programming Languages

lua
6591 projects
shell
77523 projects

nodish

A lightweight Lua equivalent to Node.js. Build Status.

Motivation / Target Audience

This framework might be for you, if you want node.js like API, but:

  • You have very limited ressources (memory)
  • You need a lua-ev backend
  • You are interested in a "Lua-only" (>90%) implementation

Unlike luvit or LuaNode this project does NOT (yet) try to be a complete node.js port. Instead it tries to keep dependecies as minimal as possible to keep size small for embedded systems. To use nodish you need:

Interpreter

Lua modules

  • ljsyscall to interface to the system (sockets,read,write,etc)
  • lua-ev as I/O loop framework

C libraries

  • Any ljsyscall compatible libc
  • libev

To reduce size further, you may be interested in squish.

NOTE: If you have no ressource problems, you should use a more robust and mature implementation like luvit or LuaNode or event better, just use the fantastic Node.js!

Examples

Echo Server

local net = require'nodish.net'
local process = require'nodish.process'

net.createServer(function(client)
	client:pipe(client)
	client:pipe(process.stdout)
  end):listen(12345)

process.loop()    

Echo Client

local net = require'nodish.net'
local process = require'nodish.process'

local client = net.connect(12345)
client:on('connect',function()
	process.stdin:pipe(client)
	client:pipe(process.stdout)
  end)

process.loop()

Installation

Linux (Debian based)

sudo add-apt-repository ppa:mwild1/ppa -y
sudo apt-get update -y
sudo apt-get install luajit -y --force-yes
sudo apt-get install libev-dev
sudo apt-get install luarocks
git clone git://github.com/justincormack/ljsyscall.git
cd ljsyscall
sudo luarocks make rockspec/ljsyscall-scm-1.rockspec
cd ../
git clone http://github.com/lipp/nodish.git
cd nodish
sudo luarocks make rockspecs/nodish-scm-1.rockspec

OSX (with homebrew)

brew install luajit
brew install libev
brew install luarocks
git clone git://github.com/justincormack/ljsyscall.git
cd ljsyscall
sudo luarocks make rockspec/ljsyscall-scm-1.rockspec
cd ../
git clone http://github.com/lipp/nodish.git
cd nodish
sudo luarocks make rockspecs/nodish-scm-1.rockspec

Status

Module Status API Remarks
net Almost complete net
events Complete events
process Partial process
buffer Almost complete buffer add buffer.release and buffer.isReleased for better buffer reuse
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].