2.0.0 • Published 6 years ago
@anchovy_studios/extract-all-zip v2.0.0
extract-all-zip
Extract all zip within a directory recursively.
Requirement
Node.js 10.0.0 or higher
Installation
Installation is done using the npm install command:
$ npm install @anchovy_studios/extract-all-zipQuick Start
const { extract } = require('extract-all-zip')
const path = 'path.to.your.folder'
try {
const files = extract(path)
console.log(files)
} catch (err) {
console.error(err)
}Documentation
Exception
The extract function will throw ExtractException object if there is an error during extraction or the path to the folder is invalid.
To get the exception message you can access its attribute:
try {
...
} catch (err) {
console.error(err.message)
}To get the native exception object or library dependency exception you can access its attribute:
try {
...
} catch (err) {
console.error(err.errObj)
}Return
The extract function will return a list of string which is the path of the zip file upon successfull extraction.
[
'path.to.file-one.zip',
'path.to.file-two.zip',
'path.to.file-three.zip'
...
]