mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-06-08 03:32:43 +02:00
Add: author object, author search api, author images #187
This commit is contained in:
@@ -19,4 +19,4 @@ module.exports.LogLevel = {
|
||||
ERROR: 4,
|
||||
FATAL: 5,
|
||||
NOTE: 6
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,4 +141,20 @@ async function recurseFiles(path) {
|
||||
// })
|
||||
return list
|
||||
}
|
||||
module.exports.recurseFiles = recurseFiles
|
||||
module.exports.recurseFiles = recurseFiles
|
||||
|
||||
module.exports.downloadFile = async (url, filepath) => {
|
||||
Logger.debug(`[fileUtils] Downloading file to ${filepath}`)
|
||||
|
||||
const writer = fs.createWriteStream(filepath)
|
||||
const response = await axios({
|
||||
url,
|
||||
method: 'GET',
|
||||
responseType: 'stream'
|
||||
})
|
||||
response.data.pipe(writer)
|
||||
return new Promise((resolve, reject) => {
|
||||
writer.on('finish', resolve)
|
||||
writer.on('error', reject)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user