文件操作 - readShebang.js
返回文件管理
返回主菜单
删除本文件
文件: /usr/lib/node_modules/npm/node_modules/cross-spawn/lib/util/readShebang.js
编辑文件内容
'use strict'; const fs = require('fs'); const shebangCommand = require('shebang-command'); function readShebang(command) { // Read the first 150 bytes from the file const size = 150; const buffer = Buffer.alloc(size); let fd; try { fd = fs.openSync(command, 'r'); fs.readSync(fd, buffer, 0, size, 0); fs.closeSync(fd); } catch (e) { /* Empty */ } // Attempt to extract shebang (null is returned if not a shebang) return shebangCommand(buffer.toString()); } module.exports = readShebang;
修改文件时间
将文件时间修改为当前时间的前一年
删除文件