大家好! 我是机械工业出版华章公司的策划编辑杜正彬。 最近,我们拿到Pedro Teixeria的新书《hands-on Node.js》中文版权,一共142页。我们想找译者,翻译这本图书。我们会支付翻译费用。
我的联系方式: 邮箱:dzb(a)hzbook.com QQ:1031703398
以下是这本书的目录部分:
Contents
Introduction
Why the sudden, exponential popularity?
What does this book cover?
What does this book not cover?
Prerequisites
Exercises
Source code
Where will this book lead you?
Why?
Why the event loop?
Solution 1: Create more call stacks
Solution 2: Use event-driven I/O
Why JavaScript?
How I Learned to Stop Fearing and Love JavaScript
Function Declaration Styles
Functions are first-class objects
JSHint
JavaScript versions
References
Starting up
Install Node
Understanding
Understanding the Node event loop
An event-queue processing loop
Callbacks that will generate events
Don’t block!
Modules and NPM
Modules
How Node resolves a module path
Core modules
CONTENTS
Modules with complete or relative path
As a file
As a directory
As an installed module
NPM - Node Package Manager
Global vs Local
NPM commands
npm ls [filter
npm install package@filters
npm rm package_name@version
npm view [@
The Packagejson Manifest
Utilities
console
util
Buffers
Slice a buffer
Copy a buffer
Buffer Exercises
Exercise 1
Exercise 2
Exercise 3
Event Emitter
addListener
once
removeAllListeners
Creating an Event Emitter
Event Emitter Exercises
Exercise 1
Exercise 2
Timers
setTimeout
clearTimeout
setInterval
clearInterval
setImmediate
Escaping the event loop
A note on tail recursion
Low-level file-system
CONTENTS
fsstat and fsfstat
Open a file
Read from a file
Write into a file
Close Your files
File-system Exercises
Exercise 1 - get the size of a file
Exercise 2 - read a chunk from a file
Exercise 3 - read two chunks from a file
Exercise 4 - Overwrite a file
Exercise 5 - append to a file
Exercise 6 - change the content of a file
HTTP
HTTP Server
The httpServerRequest object
requrl
reqmethod
reqheaders
The httpServerResponse object
Write a header
Change or set a header
Remove a header
Write a piece of the response body
HTTP Client
httpget()
httprequest()
HTTP Exercises
Exercise 1
Exercise 2
Exercise 3
Exercise 4
Streams
ReadStream
Wait for data
Know when it ends
Pause it
Resume it
WriteStream
Write to it
Wait for it to drain
Some stream examples
CONTENTS
Filesystem streams
Network streams
The Slow Client Problem and Back-pressure
What can we do?
Pipe
TCP
Write a string or a buffer
end
…and all the other methods
Idle sockets
Keep-alive
Delay or no delay
serverclose()
Listening
TCP client
Error handling
TCP Exercises
Exercise 1
Exercise 2
Datagrams (UDP)
Datagram server
Datagram client
Datagram Multicast
Receiving multicast messages
Sending multicast messages
What can be the datagram maximum size?
UDP Exercises
Exercise 1
Child processes
Executing commands
Spawning processes
Killing processes
Child Processes Exercises
Exercise 1
Streaming HTTP chunked responses
A streaming example
Streaming Exercises
Exercise 1
TLS / SSL
CONTENTS
Public / private keys
Private key
Public key
TLS Client
TLS Server
Verification
TLS Exercises
Exercise 1
Exercise 2
Exercise 3
Exercise 4
Exercise 5
HTTPS
HTTPS Server
HTTPS Client
Making modules
CommonJS modules
One file module
An aggregating module
A pseudo-class
A pseudo-class that inherits
node_modules and npm bundle
Bundling
Debugging
consolelog
Node built-in debugger
Node Inspector
Live edit
Automated Unit Testing
A test runner
Assertion testing module
shouldjs
Assert truthfulness:
or untruthfulness:
=== true
=== false
emptiness
equality
equal (strict equality)
assert numeric range (inclusive) with within
CONTENTS
test numeric value is above given value:
test numeric value is below given value:
matching regular expressions
test length
substring inclusion
assert typeof
property existence
array containment
own object keys
responds to, asserting that a given property is a fun
Putting it all together
Callback flow
The boomerang effect
Using caolan/async
Collections
Parallel Iterations
asyncforEach
asyncmap
asyncforEachLimit
asyncfilter
asyncreject
asyncreduce
asyncdetect
asyncsome
asyncevery
Flow Control
asyncseries
asyncparallel
asyncwhilst
asyncuntil
asyncwaterfall
asyncqueue
Appendix - Exercise Results
Chapter: Buffers
Exercise 1
One Solution:
Exercise 2
One Solution:
Exercise 3
One Solution:
Chapter: Event Emitter
CONTENTS
Exercise 1
One Solution:
Exercise 2
One Solution:
Chapter: Low-level File System
Exercise 1 - get the size of a file
One Solution:
Exercise 2 - read a chunk from a file
One Solution:
Exercise 3 - read two chunks from a file
One Solution:
Exercise 4 - Overwrite a file
One Solution:
Exercise 5 - append to a file
One Solution:
Exercise 6 - change the content of a file
One Solution:
Chapter: HTTP
Exercise 1
One Solution:
Exercise 2
One Solution:
Exercise 3
One Solution:
Exercise 4
One Solution:
Chapter: Child processes
Exercise 1
One Solution:
Chapter: Streaming HTTP Chunked responses
Exercise 1
One Solution:
Chapter: UDP