Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
configureLogging() {
const { loglevel } = this.options;
if (loglevel) {
log.level = loglevel;
}
// handle log.success()
log.addLevel("success", 3001, { fg: "green", bold: true });
// create logger that subclasses use
this.logger = log.newGroup(this.name);
// emit all buffered logs at configured level and higher
log.resume();
}
export function unpack (archivePath, progressGroups, targetPath) {
validate('SOS', arguments)
const name = basename(archivePath)
let gauge = progressGroups.get(name)
if (!gauge) {
gauge = log.newGroup(name)
progressGroups.set(name, gauge)
}
const unpacked = join(targetPath, createHash('sha1').update(archivePath).digest('hex'))
return Bluebird.join(
mkdirp(unpacked),
stat(archivePath)
).spread((p, stats) => new Bluebird((resolve, reject) => {
gauge.verbose('unzip', 'unpacking', archivePath, 'to', unpacked)
// openZip can't be promisified because the object stream it yields doesn't
// start paused.
openZip(archivePath, { autoClose: false }, (err, archive) => {
if (err) return reject(err)
let entryCount = archive.entryCount
export default function reader (info, progressGroups, onFinish, onError) {
const path = info.path
const name = basename(path)
let gauge = progressGroups.get(name)
if (!gauge) {
gauge = log.newGroup(name)
progressGroups.set(name, gauge)
}
const streamData = info.streamData = {}
const tags = info.tags = {}
const musicbrainzTags = info.musicbrainzTags = {}
const throughWatcher = gauge.newStream('Tags: ' + name, info.stats.size)
let textFrames = []
const rawTags = new Map()
const parser = mm(
throughWatcher,
{ duration: true, fileSize: info.stats.size },
(err) => {
// you'll get back a blank track if there's no metadata at all
if (err && err.message !== 'Could not find metadata header') {
configureLogging() {
const { loglevel } = this.options;
if (loglevel) {
log.level = loglevel;
}
// handle log.success()
log.addLevel("success", 3001, { fg: "green", bold: true });
// create logger that subclasses use
Object.defineProperty(this, "logger", {
value: log.newGroup(this.name),
});
// emit all buffered logs at configured level and higher
log.resume();
}
return Bluebird.map(files, (path) => {
progressGroups.set(basename(path), log.newGroup(path))
return scan({ path }, progressGroups)
}).then((track) => {
log.disableProgress()
}, function () {
if (linkTodoList.length === 0) return cb()
pruneTree(self.idealTree)
self.differences.length = 0
Array.prototype.push.apply(self.differences, linkTodoList)
diffTrees(self.currentTree, self.idealTree, self.differences, log.newGroup('d2'), cb)
})
}
readPackageTree(folder, iferr(cb, function (tree) {
recalculateMetadata(tree, log.newGroup('pack:' + pkg), iferr(cb, function () {
pack_(tarball, folder, tree, flattenTree(tree), pkg, cb)
}))
}))
}
Installer.prototype.loadCurrentTree = function (cb) {
validate('F', arguments)
log.silly('install', 'loadCurrentTree')
var todo = []
if (this.global) {
todo.push([this, this.readGlobalPackageData])
} else {
todo.push([this, this.readLocalPackageData])
}
todo.push(
[this, this.normalizeTree, log.newGroup('normalizeTree')])
chain(todo, cb)
}
files.forEach((f) => groups.set(f, log.newGroup('process: ' + f)))
return files