Skip to content

Commit 56e60b6

Browse files
committed
fix: add error message for file not found
Add an error message when trying to locate a non-existing file inside an archive when using `extract-file`.
1 parent 94cb8bd commit 56e60b6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/filesystem.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ class Filesystem {
139139
followLinks = typeof followLinks === 'undefined' ? true : followLinks
140140
const info = this.getNode(p)
141141

142+
if (typeof info === 'undefined') {
143+
console.error(`The file "${p}" was not found in the archive.`)
144+
process.exit(1)
145+
}
146+
142147
// if followLinks is false we don't resolve symlinks
143148
if (info.link && followLinks) {
144149
return this.getFile(info.link)

0 commit comments

Comments
 (0)