본문 바로가기

Node.js

fs 모듈(메서드)

npm을 사용하기 위해서는 설치를 먼저 해줘야 하지만,

설치 없이 기본적으로 사용할 수 있는 module도 있다.

 

1. fs module(File system)

파일 처리에 필요한 작업을 하는 모듈

const fs = require( "fs" ); // => fs 모듈 불러오기
  • Read files
  • Create files
  • Update files
  • Delete files
  • Rename files

2. 파일 읽기

fs.readFile('파일명', callback)

 

3. 파일 생성

3가지 방법이 있다.

1) fs.appendFile()

'Node.js' 카테고리의 다른 글

node-schedule은 어떻게 작동하는가?  (0) 2023.08.28
npm & package.json  (0) 2022.10.25