Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
const percent = sheetInverse.length / before.length * 100;
afterText = `, reducing non-inlined size ${percent | 0}% to ${prettyBytes(sheetInverse.length)}`;
style.$$assets[style.$$assetName] = new sources.LineToLineMappedSource(sheetInverse, style.$$assetName, before);
} else {
this.logger.warn('pruneSource is enabaled, but a style (' + name + ') has no corresponding Webpack asset.');
}
}
// replace the inline stylesheet with its critical'd counterpart
setNodeText(style, sheet);
// output stats
const percent = sheet.length / before.length * 100 | 0;
this.logger.info('\u001b[32mInlined ' + prettyBytes(sheet.length) + ' (' + percent + '% of original ' + prettyBytes(before.length) + ') of ' + name + afterText + '.\u001b[39m');
}
}
async onDeleteFiles (archive) {
try {
if (!confirm('This will delete this archive. Are you sure?')) {
return
}
const res = await beaker.archives.delete(archive.key)
toast.create(`Files deleted (${prettyBytes(res.bytes)} freed)`, '', 5e3)
this.fetchArchives()
} catch (e) {
console.error(e)
toast.create('Something went wrong', 'error')
return
}
}
async generateBundle(outputOptions, bundle, isWrite) {
for (const fileName in bundle) {
const entry = bundle[fileName]
console.log(
`${chalk.green(figures.tick)} Written: ${chalk.green(
path.relative(root, outputOptions.file)
)} in ${chalk.blue(formatDuration(start))} [${prettyBytes(entry.code.length)}]`
)
}
}
}
{assetList.map(asset =>
(
{asset.name}
{prettyBytes(asset.size)}
View
{asset.sketchName}
))}
<img class="favicon">
<h1 class="page-title">
${page.siteInfo.title && page.siteInfo.title.length
? page.siteInfo.title
: yo`<em>Untitled</em>`
}
</h1>
<div class="peer-count">
${page.siteInfo.peers || '0'} ${pluralize(page.siteInfo.peers, 'peer')} seeding these files.
<a class="link"> this.onOpenPage(HELP_DOCS_URL)}>Learn more.</a>
</div>
<div class="net-stats">
<div><span class="fa fa-arrow-down"></span> ${prettyBytes(downloadTotal)}</div>
<div><span class="fa fa-arrow-up"></span> ${prettyBytes(uploadTotal)}</div>
</div>
${this.rehostSlider ? this.rehostSlider.render() : ''}
<div class="network-url">
<a> this.onOpenPage(`beaker://library/${page.siteInfo.url}#network`)}>
<i class="fa fa-cog"></i>
View network activity
</a>
</div>
`
}
function rFile (filesBrowser, node, depth) {
return yo`
<a href="${node.url}" title="${node.name}" class="item file"> onClickNode(e, filesBrowser, node)}
oncontextmenu=${e => onContextmenuNode(e, filesBrowser, node)}
>
<i class="far fa-file"></i>
<div class="name-container"><div class="name">${node.name}</div></div>
<div class="updated">${niceMtime(node.mtime)}</div>
<div class="size">${typeof node.size === 'number' ? prettyBytes(node.size) : '--'}</div>
</a>
`
}
async _colFromSeedsColDirExists (colPath, col, seeds) {
const aColStats = await getFsStats(colPath)
const colCreateTime = moment(aColStats.birthtime)
let colLastUpdated
if (seeds.length > 0) {
colLastUpdated = moment.max(seeds.map(s => moment(s.lastUpdated)))
} else {
colLastUpdated = moment().format()
}
let colSize = '0 B', ensures = 'index'
const colWarcP = path.join(colPath, 'archive')
if (await checkPathExists(colWarcP)) {
colSize = prettyBytes(await CollectionsUtils.getColSize(colWarcP))
} else {
ensures = 'both'
}
await CollectionsUtils.ensureColDirs(colPath, ensures)
let backUpMdata = {description: `Recreated by WAIL after found to be not existing`, title: col}
let metadata
try {
metadata = await getYamlOrWriteIfAbsent(path.join(colPath, 'metadata.yaml'), backUpMdata)
} catch (getYamlError) {
backUpMdata.description = `${backUpMdata.description} but could not create file on disk.`
}
return {
_id: col,
name: col,
colPath,
size: colSize,
function size(bytes) {
const color = bytes > 1024 * 50 ? 'red' : 'green'
return chalk[color](prettyBytes(bytes))
}
totalFileSize () {
const size = this.logFiles.reduce((prev, { file }) => prev + file.size, 0);
return prettyBytes(size);
}
},
{prettyBytes(memory.used.heap.value)}/{prettyBytes(memory.max.heap.value)}
}
percent={(memory.used.heap.value / memory.max.heap.value).toFixed(2)}
/>
<b>Non Heap</b>
<br>
<span>
{prettyBytes(memory.used.nonheap.value)}/{prettyBytes(
memory.max.nonheap.value
)}
</span>
}
percent={(memory.used.nonheap.value / memory.max.nonheap.value).toFixed(2)}
/>
) : null}
);
}
}