(filePath: string, size: number)
| 128 | } |
| 129 | |
| 130 | function readFileSampleSync(filePath: string, size: number): Uint8Array { |
| 131 | if (size <= 0) return new Uint8Array() |
| 132 | const fd = fs.openSync(filePath, "r") |
| 133 | try { |
| 134 | const buffer = Buffer.alloc(Math.min(size, FILE_SIGNATURE_SAMPLE_BYTES)) |
| 135 | const bytesRead = fs.readSync(fd, buffer, 0, buffer.length, 0) |
| 136 | return buffer.subarray(0, bytesRead) |
| 137 | } finally { |
| 138 | fs.closeSync(fd) |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * Check if directory is within a git repository |
no outgoing calls
no test coverage detected