learnyounode 学习笔记——Lesson 5 – Filtered LS
learnyounode-Lesson-4
Posted on
Edited on
上一节课主要讲了在 node 中处理同步的 I/O;在 node 中大部分还是异步的情况。
课程内容:
- fs.readFile()
- readFile 中使用 callbacks 来处理异步的 I/O https://github.com/maxogden/art-of-node#callbacks
课程目标:
1 | Write a program that uses a single asynchronous filesystem operation to |
My Solution:
1 | const fs = require("fs"); |
Officical Solution:
1 | var fs = require("fs"); |
课程总结
fs.readFile(path[,options],callback)
异步 I/O(和fs.readFileSync()
相对应)
path <string> | <Buffer> | <URL> | <integer> filename or file descriptor
options <Object> | <string>
encoding <string> | <null> Default: null
flag <string> Default: ‘r’
callback <Function>
err <Error>
data <string> | <Buffer>
learnyounode Lesson 3
Posted on
Edited on
learnyounode 学习笔记——Lesson 3 – My First I/O!
learnyounode Lesson 2
Posted on
Edited on
learnyounode 学习笔记——Lesson 2-Baby Steps
learnyounode Lesson 1
learnyounode 学习笔记