- Header
- Brief description (should match package.json)
- Example (if applicable)
- Motivation (if applicable)
- API Documentation: This will likely vary considerably from library to library.
- Installation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name('hook'); | |
hook('beer', function(from, amount) { | |
// do something with that beer | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Подключение модуля fs | |
var fs = require('fs'); | |
// Вызов асинхронного метода writeFile | |
fs.writeFile('/tmp/1.txt', 'A poem', function(err) { | |
// Все готово, можно сделать что-нибудь с файлом | |
// Например, удалить его | |
fs.unlink('/tmp/1.txt', function(err) { | |
// Ну вот, теперь как-будто ничего и не делали | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Подключение модуля fs | |
var fs = require('fs'); | |
try { | |
// Вызов синхронного метода writeFile | |
fs.writeFileSync('/tmp/1.txt', 'A poem'); | |
// Все готово, можно сделать что-нибудь с файлом | |
// Например, удалить его | |
fs.unlinkSync('/tmp/1.txt'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
http.createServer(function(req, res) { | |
debugger; | |
}).listen(8080); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
http.createServer(function(req, res) { | |
if (req.url === '/') { | |
// Index page | |
res.end('hello world'); | |
} else { | |
// Favicon and everything else | |
res.writeHead(400); | |
res.end('not found'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/tmp > node debug node-debugger-example.js | |
< debugger listening on port 5858 | |
connecting... ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CryptoStream.prototype._push = function() { | |
if (this == this.pair.encrypted && !this.writable) { | |
// If the encrypted side got EOF, we do not attempt | |
// to write out data anymore. | |
return; | |
} | |
while (!this._paused) { | |
<<<<<<< HEAD | |
var bytesRead = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cluster = require('cluster'), | |
https = require('https'), | |
fs = require('fs'), | |
Buffer = require('buffer').Buffer; | |
function start() { | |
var options = { | |
key: fs.readFileSync('./test/fixtures/test_key.pem'), | |
cert: fs.readFileSync('./test/fixtures/test_cert.pem') | |
}; |
So you're mad opensource hacker, spent days and nights working with node.js and/or network protocols. Time to show other people how cool you are!
This file describes all logic of Vock's peer-to-peer protocol (which works over UDP). And there's an issue hidden behind it's lines. Find it, fix it or just get into hacking on Vock - and you'll be awarded! Your name will be in github project's readme and I'll mention your on my twitter account.
Cheers,
Fedor Indutny (https://github.com/indutny)