Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to Node and its Core Modules
Search
aryoung
February 06, 2013
Programming
290
3
Share
Introduction to Node and its Core Modules
From
http://bathcamp.org/
, February 6th 2013
aryoung
February 06, 2013
More Decks by aryoung
See All by aryoung
Vim and the Web
aryoung
0
7.8k
Tern for Vim
aryoung
2
1.7k
Vim London: Custom Motions
aryoung
6
3.8k
Other Decks in Programming
See All in Programming
Codex CLI でつくる、Issue から merge までの開発フロー
amata1219
0
360
VueエンジニアがReactを触って感じた_設計の違い
koukimiura
0
170
飯MCP
yusukebe
0
510
Google Nest CamとApple Vision frameworkと猫🐈🐈⬛ / onishi50
yutailang0119
0
110
Coding at the Speed of Thought: The New Era of Symfony Docker
dunglas
0
4.9k
ファインチューニングせずメインコンペを解く方法
pokutuna
0
310
KagglerがMixSeekを触ってみた
morim
0
380
「話せることがない」を乗り越える 〜日常業務から登壇テーマをつくる思考法〜
shoheimitani
4
790
AWS re:Invent 2025の少し振り返り + DevOps AgentとBacklogを連携させてみた
satoshi256kbyte
3
160
CursorとClaudeCodeとCodexとOpenCodeを実際に比較してみた
terisuke
1
450
Laravel Nightwatchの裏側 - Laravel公式Observabilityツールを支える設計と実装
avosalmon
1
330
実践CRDT
tamadeveloper
0
550
Featured
See All Featured
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
64
54k
Abbi's Birthday
coloredviolet
2
7k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
810
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
Designing Experiences People Love
moore
143
24k
Making Projects Easy
brettharned
120
6.6k
Utilizing Notion as your number one productivity tool
mfonobong
4
290
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
210
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
270
Everyday Curiosity
cassininazir
0
200
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
Transcript
Introduction to Node Alex
Overview ‣ Brief
5 Years Ago... ‣ We
Thursday, 7 February 13
A
Node’s Strengths ‣ Network-oriented
Installation ‣ Wizards
Runtime Environment ‣ Every
Modules ‣ CommonJS
Core Modules ‣ Events,
"Node's
Why Bother? ‣ Events/streams
Streams var zlib = require('zlib').createGzip(); var fs = require('fs'); var
inp = fs.createReadStream('input.txt'); var out = fs.createWriteStream('output.txt.gz'); inp.pipe(gzip).pipe(out); Clean,
Events var util = require('util'); var events = require('events'); function
Player() { events.EventEmitter.call(this); } util.inherits(Player, events.EventEmitter); var player = new Player(); player.on('play', function(track) { console.log('[NP]:', track.title); }); player.emit('play', { title: 'Spit On A Stranger', artist: 'Pavement' }); Thursday, 7 February 13
Servers var net = require('net'); var server = net.createServer(function(c) {
console.log('server connected'); c.on('end', function() { console.log('server disconnected'); }); c.write('hello\r\n'); c.pipe(c); }); server.listen(8124, function() { //'listening' listener console.log('server bound'); }); Thursday, 7 February 13
HTTP Server var http = require('http'); var fs = require('fs');
http.createServer(function(req, res) { fs.readFile(__dirname + 'index.html', function(err, data) { if (err) { res.statusCode = 500; res.end(String(err)); } else { res.end(data); } }); }).listen(8000); Thursday, 7 February 13
HTTP Server var http = require('http'); var fs = require('fs');
http.createServer(function(req, res) { fs.readFile(__dirname + 'index.html', function(err, data) { if (err) { res.statusCode = 500; res.end(String(err)); } else { res.end(data); } }); }).listen(8000); Thursday, 7 February 13
HTTP Server var http = require('http'); var fs = require('fs');
http.createServer(function(req, res) { fs.readFile(__dirname + 'index.html', function(err, data) { if (err) { res.statusCode = 500; res.end(String(err)); } else { res.end(data); } }); }).listen(8000); Thursday, 7 February 13
HTTP Server var http = require('http'); var fs = require('fs');
http.createServer(function(req, res) { fs.readFile(__dirname + 'index.html', function(err, data) { if (err) { res.statusCode = 500; res.end(String(err)); } else { res.end(data); } }); }).listen(8000); Not
Streams with HTTP var http = require('http'); var fs =
require('fs'); http.createServer(function(req, res) { var stream = fs.createReadStream('index.html'); stream.pipe(res); }).listen(8000); Thursday, 7 February 13
Gzip for Free var http = require('http'); var fs =
require('fs'); var zlib = require('zlib'); http.createServer(function(req, res) { var stream = fs.createReadStream('index.html'); res.writeHead(200, { 'content-encoding': 'gzip' }); stream.pipe(zlib.createGzip()).pipe(res); }).listen(8000); Thursday, 7 February 13
Gzip for Free var http = require('http'); var fs =
require('fs'); var zlib = require('zlib'); http.createServer(function(req, res) { var stream = fs.createReadStream('index.html'); res.writeHead(200, { 'content-encoding': 'gzip' }); stream.pipe(zlib.createGzip()).pipe(res); }).listen(8000); How
TO-DO: Learn
The End http://www.flickr.com/photos/dunechaser/6884829633/ Thursday, 7 February 13