This commit is contained in:
Ryan Dahl 2010-08-21 01:19:39 -07:00
Родитель 33e919ae6f
Коммит 488aff085b
5 изменённых файлов: 38 добавлений и 19 удалений

Просмотреть файл

@ -1,6 +1,6 @@
for (var i = 0; i < 9000000; i++) {
for (var i = 0; i < 9e7; i++) {
b = new Buffer(10);
b[1] = 2
}

Просмотреть файл

@ -1,6 +1,6 @@
for (var i = 0; i < 9000000; i++) {
for (var i = 0; i < 9e7; i++) {
s = '01234567890';
s[1] = "a";
}

Просмотреть файл

@ -3289,41 +3289,40 @@ For the moment, that is all the documentation on addons. Please see
## Appendix - Third Party Modules
There are many third party modules for Node. At the time of writing, August
2010, the master repository of modules is the wiki page at
http://github.com/ry/node/wiki/modules
2010, the master repository of modules is
http://github.com/ry/node/wiki/modules[the wiki page].
This appendix is intended as a SMALL guide to new-comers to help them
quickly find what are considered to be quality modules. It is not intended
to be a complete list. There may be better more complete modules found
elsewhere.
Package System: NPM http://github.com/isaacs/npm
- Module Installer: [NPM](http://github.com/isaacs/npm)
HTML Parsing: HTML5 http://github.com/aredridel/html5
- HTTP Middleware: [Connect](http://github.com/senchalabs/connect)
HTTP Middleware: Connect http://github.com/senchalabs/connect
- Web Framework: [Express](http://github.com/visionmedia/express)
Web Framework: Express http://github.com/visionmedia/express
- Web Sockets: [Socket.IO](http://github.com/LearnBoost/Socket.IO-node)
Web Sockets: Socket.IO http://github.com/LearnBoost/Socket.IO-node
- HTML Parsing: [HTML5](http://github.com/aredridel/html5)
mDNS/Zeroconf/Bonjour: mDNS http://github.com/agnat/node_mdns
- [mDNS/Zeroconf/Bonjour](http://github.com/agnat/node_mdns)
RabbitMQ, AMQP: http://github.com/ry/node-amqp
- [RabbitMQ, AMQP](http://github.com/ry/node-amqp)
MySQL: http://github.com/felixge/node-mysql
- [mysql](http://github.com/felixge/node-mysql)
Serialization: http://github.com/pgriess/node-msgpack
- Serialization: [msgpack](http://github.com/pgriess/node-msgpack)
Scraping: http://github.com/silentrob/Apricot
- Scraping: [Apricot](http://github.com/silentrob/Apricot)
Debugger: ndb http://github.com/smtlaissezfaire/ndb is a CLI debugger
Node-Inspector http://github.com/dannycoates/node-inspector is a web based
- Debugger: [ndb](http://github.com/smtlaissezfaire/ndb) is a CLI debugger
[inspector](http://github.com/dannycoates/node-inspector) is a web based
tool.
pcap binding: http://github.com/mranney/node_pcap
- [pcap binding](http://github.com/mranney/node_pcap)
ncurses: http://github.com/mscdex/node-ncurses
- [ncurses](http://github.com/mscdex/node-ncurses)
Patches to this list are welcome.

Просмотреть файл

@ -701,6 +701,22 @@ Handle<Value> Buffer::ByteLength(const Arguments &args) {
}
Handle<Value> Buffer::MakeFastBuffer(const Arguments &args) {
HandleScope scope;
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(args[0]->ToObject());
Local<Object> fast_buffer = args[1]->ToObject();;
uint32_t offset = args[2]->Uint32Value();
uint32_t length = args[3]->Uint32Value();
fast_buffer->SetIndexedPropertiesToPixelData((uint8_t*)buffer->data() + offset,
length);
return Undefined();
}
void Buffer::Initialize(Handle<Object> target) {
HandleScope scope;
@ -731,6 +747,9 @@ void Buffer::Initialize(Handle<Object> target) {
NODE_SET_METHOD(constructor_template->GetFunction(),
"byteLength",
Buffer::ByteLength);
NODE_SET_METHOD(constructor_template->GetFunction(),
"makeFastBuffer",
Buffer::MakeFastBuffer);
target->Set(String::NewSymbol("Buffer"), constructor_template->GetFunction());
}

Просмотреть файл

@ -61,6 +61,7 @@ class Buffer : public ObjectWrap {
static v8::Handle<v8::Value> AsciiWrite(const v8::Arguments &args);
static v8::Handle<v8::Value> Utf8Write(const v8::Arguments &args);
static v8::Handle<v8::Value> ByteLength(const v8::Arguments &args);
static v8::Handle<v8::Value> MakeFastBuffer(const v8::Arguments &args);
static v8::Handle<v8::Value> Unpack(const v8::Arguments &args);
static v8::Handle<v8::Value> Copy(const v8::Arguments &args);