├── nbproject
├── project.properties
├── private
│ ├── private.properties
│ ├── private.xml
│ └── configurations.xml
├── project.xml
├── configurations.xml
└── Package-Default.bash
├── .gitignore
├── binding.gyp
├── Makefile
├── wscript
├── package.json
├── test
├── speedtest.js
└── test.js
├── pack.h
├── README
├── example
└── packit.js
├── hipack.js
├── README.md
├── pack.c
└── pack.cc
/nbproject/project.properties:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .idea
3 | *.tgz
4 | build
5 | *~
6 | *.~
7 |
--------------------------------------------------------------------------------
/binding.gyp:
--------------------------------------------------------------------------------
1 | {
2 | "targets": [
3 | {
4 | "target_name": "hipack",
5 | "sources": [ "pack.cc" ]
6 | }
7 | ],
8 | 'cflags': [
9 | '-Wall',
10 | '-O3'
11 | ]
12 | }
--------------------------------------------------------------------------------
/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0
5 | 0
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | BIN = ./node_modules/.bin
2 | MOCHA_OPTS = --timeout 10s --recursive
3 | REPORTER = spec
4 | TEST_FILES = test/acceptance
5 |
6 | all:
7 | #$(MAKE) static
8 | node-gyp configure build
9 |
10 | clean:
11 | rm -rf build
12 |
13 | lint:
14 | $(BIN)/jshint hipack.js test/*
15 |
16 | temp:
17 | rm -rf tmp/hipack
18 | mkdir -p tmp/hipack
19 | cp -r README *.{cc,h,js*} binding.gyp Makefile test tmp/hipack
20 | cd tmp/hipack
21 |
22 | test:
23 | node test/test.js
24 |
25 | install:
26 | @npm install
27 |
28 | package: temp install
29 | cd tmp && tar -czvf hipack.tgz hipack
30 | @npm hipack
31 |
32 |
--------------------------------------------------------------------------------
/wscript:
--------------------------------------------------------------------------------
1 | import Options
2 | from os import unlink, symlink, popen
3 | from os.path import exists
4 |
5 | srcdir = '.'
6 | blddir = 'build'
7 | VERSION = '0.1.0'
8 |
9 | def set_options(opt):
10 | opt.tool_options('compiler_cxx')
11 |
12 | def configure(conf):
13 | conf.check_tool('compiler_cxx')
14 | conf.check_tool('node_addon')
15 | conf.env.append_unique('CXXFLAGS', ['-Wall', '-O3'])
16 | conf.env['LIB_PACK'] = 'hipack'
17 |
18 | def build(bld):
19 | obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')
20 | obj.cxxflags = ["-I../deps", "-g", "-Wall"]
21 | obj.target = "hipack"
22 | obj.source = 'pack.cc'
23 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "hipack",
3 | "description": "HiSpeed Pack/Unpack of bytes formats, just like PHP and PERL",
4 | "version": "1.0.4",
5 | "repository": {
6 | "type": "git",
7 | "url": "git://github.com/rauls/nodejs-pack.git"
8 | },
9 |
10 | "homepage": "http://github.com/rauls/nodejs-pack",
11 | "author": "Raul Sobon ",
12 | "main": "./build/Release/hipack",
13 | "directories": {
14 | "lib": "."
15 | },
16 | "scripts": {
17 | "_preinstall": "make || gmake",
18 | "test": "node test/test.js"
19 | },
20 | "engines": {
21 | "node": ">=0.8.0"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/test/speedtest.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/node
2 |
3 | var pack = require( "hipack" );
4 |
5 |
6 | // Loop overhead is 50ms for 1m items.
7 | // Calling pack.N is a 500ms overhead doing 'nothing'
8 | function SpeedTest()
9 | {
10 | var raw;
11 | console.log("Performing a speed test, 1M packs()" );
12 |
13 | var t1 = new Date();
14 | var tot = 1e6;
15 | for(i=0;i
10 | #include
11 | #include
12 |
13 | using namespace v8;
14 |
15 | #define NODEJS_MINIT_FUNCTION(_fname_) void (_fname_) (Handle