(n, kind)
| 271 | // Path of the n-th file of `kind`, or null. Python-style indexing: |
| 272 | // 0..N-1 from the start, -1..-N from the end. |
| 273 | pathAt(n, kind) { |
| 274 | const files = this.list(kind) |
| 275 | if (!files.length) return null |
| 276 | const i = n < 0 ? files.length + n : n |
| 277 | if (i < 0 || i >= files.length) return null |
| 278 | return path.join(this.dir, files[i]) |
| 279 | } |
| 280 | |
| 281 | // Read content of the n-th file of `kind`. Binary kinds (screenshot) are |
| 282 | // returned as Buffer; text kinds as utf8 string. |