How to use the ipfs-repo.repoVersion function in ipfs-repo

To help you get started, we’ve selected a few ipfs-repo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ipfs / js-ipfs / test / cli / version.js View on Github external
/* 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 () => {
github ipfs / js-ipfs / test / cli / repo.js View on Github external
/* 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)
github ipfs / js-ipfs / src / core / components / repo.js View on Github external
'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 () => {

ipfs-repo

IPFS Repo implementation

Apache-2.0 OR MIT
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis