(path: string)
| 896 | |
| 897 | // Split at the last slash that fits the 155-byte USTAR prefix. |
| 898 | const splitPath = (path: string): readonly [prefix: string, name: string] | undefined => { |
| 899 | if (path.length <= 100 || !isAscii(path)) return undefined |
| 900 | let length = path.length |
| 901 | if (length > 156) length = 156 |
| 902 | else if (path[length - 1] === "/") length-- |
| 903 | const i = path.lastIndexOf("/", length - 1) |
| 904 | if (i <= 0 || path.length - i - 1 > 100) return undefined |
| 905 | return [path.slice(0, i), path.slice(i + 1)] |
| 906 | } |
| 907 | |
| 908 | interface UstarFields { |
| 909 | readonly name: string |
no test coverage detected