Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const filesize = require('filesize').partial({ unix: true })
const Chalk = require('chalk')
const formatPaths = require('./paths')
const formatData = require('./data')
module.exports = function formatDagNode (cid, info, paths) {
const out = []
out.push(Chalk.magenta(`${cid.codec} DAG Node`))
const cidStr = cid.toBaseEncodedString()
if (info.remainderPath) {
out.push(`${Chalk.gray('Path:')} ${cidStr}/${info.remainderPath}`)
} else {
out.push(`${Chalk.gray('CID:')} ${cidStr}`)
}
import React from 'react'
import { ObjectInspector, chromeLight } from '@tableflip/react-inspector'
import filesize from 'filesize'
import LinksTable from './LinksTable'
const humansize = filesize.partial({ round: 0 })
const objectInspectorTheme = {
...chromeLight,
BASE_FONT_SIZE: '13px',
BASE_LINE_HEIGHT: '19px',
TREENODE_FONT_SIZE: '13px',
TREENODE_LINE_HEIGHT: '19px'
}
const nodeStyles = {
'dag-cbor': { shortName: 'CBOR', name: 'CBOR DAG Node', color: '#28CA9F' },
'dag-pb': { shortName: 'PB', name: 'Protobuf DAG Node', color: '#244e66' }
}
export function shortNameForNode (type) {
const style = nodeStyles[type]
const Table = require('cli-table')
const filesize = require('filesize').partial({ unix: true })
const Chalk = require('chalk')
const tableOptions = {
chars: {
'top': '',
'top-mid': '',
'top-left': '',
'top-right': '',
'bottom': '',
'bottom-mid': '',
'bottom-left': '',
'bottom-right': '',
'left': '',
'left-mid': '',
'mid': '',
'mid-mid': '',
const { inspect } = require('util')
const filesize = require('filesize').partial({ unix: true })
const Chalk = require('chalk')
const formatLinks = require('./links')
module.exports = function formatDag (node) {
let formattedLinks = ''
if (node.links.length) {
formattedLinks = `
${Chalk.gray('Links:')}
${formatLinks(node.cid, node.links)}`
}
let formattedSize = ''
import React from 'react'
import ReactDOM from 'react-dom'
import { Line } from 'react-chartjs-2'
import { withTranslation } from 'react-i18next'
import { connect } from 'redux-bundler-react'
import PropTypes from 'prop-types'
import filesize from 'filesize'
import { Title } from './Commons'
const chartsize = filesize.partial({ round: 1, exponent: 2, bits: true })
const tootltipSize = filesize.partial({ round: 0, bits: true, output: 'array' })
const defaultSettings = {
defaultFontFamily: "'Inter UI', system-ui, sans-serif",
responsive: true,
tooltips: {
mode: 'x',
position: 'nearest',
enabled: false
},
hover: { mode: 'index' },
scales: {
xAxes: [{
type: 'time',
time: {
minUnit: 'second'
}
import React from 'react'
import ReactDOM from 'react-dom'
import { Line } from 'react-chartjs-2'
import { withTranslation } from 'react-i18next'
import { connect } from 'redux-bundler-react'
import PropTypes from 'prop-types'
import filesize from 'filesize'
import { Title } from './Commons'
const chartsize = filesize.partial({ round: 1, exponent: 2, bits: true })
const tootltipSize = filesize.partial({ round: 0, bits: true, output: 'array' })
const defaultSettings = {
defaultFontFamily: "'Inter UI', system-ui, sans-serif",
responsive: true,
tooltips: {
mode: 'x',
position: 'nearest',
enabled: false
},
hover: { mode: 'index' },
scales: {
xAxes: [{
type: 'time',
time: {
minUnit: 'second'
import React, { Component } from 'react'
import { connect } from 'redux-bundler-react'
import { withTranslation } from 'react-i18next'
import PropTypes from 'prop-types'
import filesize from 'filesize'
import CountryFlag from 'react-country-flag'
import Box from '../components/box/Box'
import { Title } from './Commons'
import ComponentLoader from '../loader/ComponentLoader.js'
const isWindows = window.navigator.appVersion.indexOf('Win') !== -1
const humansize = filesize.partial({ round: 0 })
export class PeerBandwidthTable extends Component {
static propTypes = {
peerBandwidthPeers: PropTypes.array.isRequired,
peerLocations: PropTypes.object.isRequired
}
state = {
sort: { field: 'rateOut', direction: -1 },
showAll: false
}
getSorter ({ field, direction }) {
return (a, b) => {
if (a.bw[field].gt(b.bw[field])) return direction
if (a.bw[field].lt(b.bw[field])) return -direction