Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint max-nested-callbacks: ["error", 5] */
/* eslint-env mocha */
'use strict'
const os = require('os')
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const repoVersion = require('ipfs-repo').repoVersion
const pkgversion = require('../../package.json').version
const runOnAndOff = require('../utils/on-and-off')
describe('version', () => runOnAndOff((thing) => {
let ipfs
before(() => {
ipfs = thing.ipfs
})
it('get the version', async () => {
const out = await ipfs('version')
expect(out).to.eql(`js-ipfs version: ${pkgversion}\n`)
})
it('handles --number', async () => {
/* eslint-env mocha */
'use strict'
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const repoVersion = require('ipfs-repo').repoVersion
const runOnAndOff = require('../utils/on-and-off')
describe('repo', () => runOnAndOff((thing) => {
let ipfs
before(() => {
ipfs = thing.ipfs
})
it('get repo stats', async () => {
const stats = await ipfs('repo stat')
expect(stats).to.match(/^NumObjects:\s\d+$/m)
expect(stats).to.match(/^RepoSize:\s\d+$/m)
expect(stats).to.match(/^StorageMax:\s\d+$/m)
expect(stats).to.match(/^RepoPath:\s.+$/m)
expect(stats).to.match(/^Version:\s\d+$/m)
'use strict'
const repoVersion = require('ipfs-repo').repoVersion
const callbackify = require('callbackify')
module.exports = function repo (self) {
return {
init: callbackify(async (bits, empty) => {
// 1. check if repo already exists
}),
/**
* If the repo has been initialized, report the current version.
* Otherwise report the version that would be initialized.
*
* @param {function(Error, Number)} [callback]
* @returns {undefined}
*/
version: callbackify(async () => {