Skip to content

Commit

Permalink
ch08
Browse files Browse the repository at this point in the history
  • Loading branch information
becho2 committed Aug 10, 2022
1 parent a5829ed commit cdf4293
Show file tree
Hide file tree
Showing 11 changed files with 823 additions and 0 deletions.
342 changes: 342 additions & 0 deletions ch07/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions ch07/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "ch07",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "ts-node src",
"build": "tsc && node dist"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "^18.6.2",
"ts-node": "^10.9.1",
"typescript": "^4.7.4"
}
}
12 changes: 12 additions & 0 deletions ch07/src/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { readFileSync, readFile, read } from "fs";

// package.json 파일을 동기 방식으로 읽는 예
console.log('read package.json using synchronous api...')
const buffer: Buffer = readFileSync('../package.json')
console.log(buffer.toString())

// package.json 파일을 ql동기 방식으로 읽는 예
readFile('../package.json', (error, buffer: Buffer) => {
console.log('read package.json using asynchronous api...')
console.log(buffer.toString())
})
Loading

0 comments on commit cdf4293

Please sign in to comment.