Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const lookup = {}
for (let mod of decrypted)
lookup[mod.relative] = mod
let nextObj = null
while (nextObj = enumerator.nextObject()) {
const relative = nextObj.toString()
if (/(\_CodeSignature\/CodeResources|SC_Info\/\w+\.s(inf|upf|upp|upx))$/.test(relative))
continue
if (!opt.keepWatch && /^Watch\//.test(relative))
continue
const absolute = path.join(root, relative)
const st = fs.statSync(absolute)
if (st.mode & fs.constants.S_IFDIR) {
// doesn't need to handle?
continue
} else if (!(st.mode & fs.constants.S_IFREG)) {
console.error('unknown file mode', absolute)
}
if (opt.verbose)
console.log('compress:', relative)
const entry = libarchive.entryNew()
libarchive.entrySetPathname(entry, Memory.allocUtf8String(path.join(prefix, relative)))
libarchive.entrySetSize(entry, st.size)
libarchive.entrySetFiletype(entry, fs.constants.S_IFREG)
libarchive.entrySetPerm(entry, st.mode & 0o777)
libarchive.entrySetCtime(entry, timestamp(st.ctime), 0)
libarchive.entrySetMtime(entry, timestamp(st.mtime), 0)
let nextObj = null
while (nextObj = enumerator.nextObject()) {
const relative = nextObj.toString()
if (/(\_CodeSignature\/CodeResources|SC_Info\/\w+\.s(inf|upf|upp|upx))$/.test(relative))
continue
if (!opt.keepWatch && /^Watch\//.test(relative))
continue
const absolute = path.join(root, relative)
const st = fs.statSync(absolute)
if (st.mode & fs.constants.S_IFDIR) {
// doesn't need to handle?
continue
} else if (!(st.mode & fs.constants.S_IFREG)) {
console.error('unknown file mode', absolute)
}
if (opt.verbose)
console.log('compress:', relative)
const entry = libarchive.entryNew()
libarchive.entrySetPathname(entry, Memory.allocUtf8String(path.join(prefix, relative)))
libarchive.entrySetSize(entry, st.size)
libarchive.entrySetFiletype(entry, fs.constants.S_IFREG)
libarchive.entrySetPerm(entry, st.mode & 0o777)
libarchive.entrySetCtime(entry, timestamp(st.ctime), 0)
libarchive.entrySetMtime(entry, timestamp(st.mtime), 0)
libarchive.writeHeader(ar, entry)
const filename = relative in lookup ? lookup[relative].decrypted : absolute