Created
June 11, 2019 01:02
-
-
Save LinZap/7b8fe6f3e13dd3fe4689353dbf19f541 to your computer and use it in GitHub Desktop.
Node.js - HK10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require('fs') | |
| let dir_path = __dirname + '/storage' | |
| let file_path = dir_path + '/hello.txt' | |
| let str = 'Hello world' | |
| if (!fs.existsSync(dir_path)) | |
| fs.mkdirSync(dir_path) | |
| if (fs.existsSync(file_path)) | |
| fs.appendFileSync(file_path, str) | |
| else | |
| fs.writeFileSync(file_path, str) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment