(filePath: string, size: number)
| 16 | * 读取文件头部指定字节数 |
| 17 | */ |
| 18 | export function readFileHeadBytes(filePath: string, size: number): string { |
| 19 | const fd = fs.openSync(filePath, 'r') |
| 20 | const buffer = Buffer.alloc(size) |
| 21 | const bytesRead = fs.readSync(fd, buffer, 0, size, 0) |
| 22 | fs.closeSync(fd) |
| 23 | return buffer.slice(0, bytesRead).toString('utf-8') |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * 创建进度对象 |
no outgoing calls
no test coverage detected