1.0.6 • Published 6 years ago
ihaiu-file v1.0.6
ihaiu.nodejsfile
nodejs 文件操作
- 拷贝文件或目录
ihaiu-file -C copy -s ./ -t ./aa/bb/cc     - 创建文件夹
ihaiu-file -C mkdir -s ./aa/bb/cc/dd   - 删除文件或者目录
ihaiu-file -C delete -s ./aa/bb/cc/dd- 文件写入
ihaiu-file -C write -s ./aaa/bb/a.txt -b "Hello World中午2" -f w  -e utf8- 文件读取
ihaiu-file -C read -s ./aaa/bb/a.txt- 文件重命名或者移动文件
ihaiu-file -C rename -s ./aa/cc/a.txt -d ./aa/cc/b.txt -o trueUsage: index [options]
Options:
  -V, --version           output the version number
  -C, --cmd <lang>        命令名称: copy、delete、 mkdir、write、 read、 rename
  -s, --srcpath <path>    路径
  -d, --destpath [path]   拷贝文件目标路径
  -o, --over [boolean]    是否覆盖
  -i, --ignorehide        是否忽略隐藏文件
  -b, --body [lang]       写入文件的内容
  -f, --flag [lang]       写入文件的flag, w, http://nodejs.cn/api/fs.html#fs_file_system_flags
  -e, --encoding  [lang]  默认值: utf8
  -h, --help              output usage information学习开发npm笔记
创建npm项目
- github创建一个项目clone到本地
- 执行 npm init 命令配置一些paackage.json
npm init- 创建一个index.js文件
- 执行 npm login 登录
- 执行 npm publish 推送
安装依赖
安装 fs,path等依赖
cnpm install @types/node --save-dev安装 命令行依赖
cnpm install commander --save创建TypeScript项目
- tsc -init
- 修改package.js
"main": "bin/index.js",编译TypeScript项目
tsc测试
node bin/index.js1.0.6
6 years ago