feat: 초기 프로젝트 설정 및 룰.md 파일 추가

This commit is contained in:
2025-07-28 09:53:31 +09:00
commit 09a4d38512
8165 changed files with 1021855 additions and 0 deletions

41
api.hyungi.net/node_modules/amp/Readme.md generated vendored Normal file
View File

@@ -0,0 +1,41 @@
# amp
Abstract Message Protocol codec and streaming parser for nodejs.
## Installation
```
$ npm install amp
```
## Example
```js
var bin = amp.encode([new Buffer('hello'), new Buffer('world')]);
var msg = amp.decode(bin);
console.log(msg);
```
## Protocol
AMP is a simple versioned protocol for framed messages containing
zero or more "arguments". Each argument is opaque binary, thus you
may use JSON, BSON, msgpack and others on top of AMP. Multiple argument
support is used to allow a hybrid of binary/non-binary message args without
requiring higher level serialization libraries like msgpack or BSON.
All multi-byte integers are big endian. The `version` and `argc` integers
are stored in the first byte, followed by a sequence of zero or more
`<length>` / `<data>` pairs, where `length` is a 32-bit unsigned integer.
```
0 1 2 3 4 <length> ...
+------------+----------+------------+
| <ver/argc> | <length> | <data> | additional arguments
+------------+----------+------------+
```
# License
MIT

5
api.hyungi.net/node_modules/amp/index.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
exports.Stream = require('./lib/stream');
exports.encode = require('./lib/encode');
exports.decode = require('./lib/decode');

29
api.hyungi.net/node_modules/amp/lib/decode.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
/**
* Decode the given `buf`.
*
* @param {Buffer} buf
* @return {Object}
* @api public
*/
module.exports = function(buf){
var off = 0;
// unpack meta
var meta = buf[off++];
var version = meta >> 4;
var argv = meta & 0xf;
var args = new Array(argv);
// unpack args
for (var i = 0; i < argv; i++) {
var len = buf.readUInt32BE(off);
off += 4;
var arg = buf.slice(off, off += len);
args[i] = arg;
}
return args;
};

44
api.hyungi.net/node_modules/amp/lib/encode.js generated vendored Normal file
View File

@@ -0,0 +1,44 @@
/**
* Protocol version.
*/
var version = 1;
/**
* Encode `msg` and `args`.
*
* @param {Array} args
* @return {Buffer}
* @api public
*/
module.exports = function(args){
var argc = args.length;
var len = 1;
var off = 0;
// data length
for (var i = 0; i < argc; i++) {
len += 4 + args[i].length;
}
// buffer
var buf = new Buffer(len);
// pack meta
buf[off++] = version << 4 | argc;
// pack args
for (var i = 0; i < argc; i++) {
var arg = args[i];
buf.writeUInt32BE(arg.length, off);
off += 4;
arg.copy(buf, off);
off += arg.length;
}
return buf;
};

105
api.hyungi.net/node_modules/amp/lib/stream.js generated vendored Normal file
View File

@@ -0,0 +1,105 @@
/**
* Module dependencies.
*/
var Stream = require('stream').Writable;
var encode = require('./encode');
/**
* Expose parser.
*/
module.exports = Parser;
/**
* Initialize parser.
*
* @param {Options} [opts]
* @api public
*/
function Parser(opts) {
Stream.call(this, opts);
this.state = 'message';
this._lenbuf = new Buffer(4);
}
/**
* Inherit from `Stream.prototype`.
*/
Parser.prototype.__proto__ = Stream.prototype;
/**
* Write implementation.
*/
Parser.prototype._write = function(chunk, encoding, fn){
for (var i = 0; i < chunk.length; i++) {
switch (this.state) {
case 'message':
var meta = chunk[i];
this.version = meta >> 4;
this.argv = meta & 0xf;
this.state = 'arglen';
this._bufs = [new Buffer([meta])];
this._nargs = 0;
this._leni = 0;
break;
case 'arglen':
this._lenbuf[this._leni++] = chunk[i];
// done
if (4 == this._leni) {
this._arglen = this._lenbuf.readUInt32BE(0);
var buf = new Buffer(4);
buf[0] = this._lenbuf[0];
buf[1] = this._lenbuf[1];
buf[2] = this._lenbuf[2];
buf[3] = this._lenbuf[3];
this._bufs.push(buf);
this._argcur = 0;
this.state = 'arg';
}
break;
case 'arg':
// bytes remaining in the argument
var rem = this._arglen - this._argcur;
// consume the chunk we need to complete
// the argument, or the remainder of the
// chunk if it's not mixed-boundary
var pos = Math.min(rem + i, chunk.length);
// slice arg chunk
var part = chunk.slice(i, pos);
this._bufs.push(part);
// check if we have the complete arg
this._argcur += pos - i;
var done = this._argcur == this._arglen;
i = pos - 1;
if (done) this._nargs++;
// no more args
if (this._nargs == this.argv) {
this.state = 'message';
this.emit('data', Buffer.concat(this._bufs));
break;
}
if (done) {
this.state = 'arglen';
this._leni = 0;
}
break;
}
}
fn();
};

15
api.hyungi.net/node_modules/amp/package.json generated vendored Normal file
View File

@@ -0,0 +1,15 @@
{
"name": "amp",
"version": "0.3.1",
"repository": "visionmedia/node-amp",
"description": "Abstract messaging protocol",
"keywords": ["amp", "actor", "message", "messaging", "zmq", "zeromq"],
"dependencies": {},
"files": ["index.js", "lib/*.js"],
"devDependencies": {
"matcha": "~0.4.0",
"mocha": "*",
"should": "*"
},
"license": "MIT"
}