Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ipfs-log

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-log - npm Package Compare versions

Comparing version 1.6.0-beta.7 to 1.6.0-beta.8

3

package.json
{
"name": "ipfs-log",
"version": "1.6.0-beta.7",
"version": "1.6.0-beta.8",
"description": "Append-only log for IPFS",

@@ -30,2 +30,3 @@ "main": "src/log.js",

"mocha": "^3.0.1",
"rimraf": "^2.5.4",
"stream-http": "^2.5.0",

@@ -32,0 +33,0 @@ "webpack": "^2.1.0-beta.28"

# ipfs-log
[![npm version](https://badge.fury.io/js/ipfs-log.svg)](https://badge.fury.io/js/ipfs-log)
[![CircleCI Status](https://circleci.com/gh/haadcode/ipfs-log.svg?style=shield)](https://circleci.com/gh/haadcode/ipfs-log)
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
> An append-only log on IPFS.
`ipfs-log` is a *partially ordered linked list* of [IPFS](https://github.com/ipfs/ipfs) objects.
`ipfs-log` is a *partially ordered, append-only linked list* of [IPFS](https://github.com/ipfs/ipfs) objects.

@@ -7,0 +11,0 @@ ## Table of Contents

@@ -36,3 +36,3 @@ 'use strict'

id: this.id,
items: this._currentBatch.map((f) => f.hash)
items: this._heads
}

@@ -39,0 +39,0 @@ }

'use strict'
const _ = require('lodash')
const assert = require('assert')
const async = require('asyncawait/async')
const await = require('asyncawait/await')
const rmrf = require('rimraf')
const IpfsApis = require('ipfs-test-apis')

@@ -12,2 +12,4 @@ const Entry = require('../src/entry')

const dataPath = '/tmp/ipfs-log-test'
IpfsApis.forEach(function(ipfsApi) {

@@ -18,4 +20,5 @@

before(async(() => {
rmrf.sync(dataPath)
try {
ipfs = await(ipfsApi.start())
ipfs = await(ipfsApi.start({ IpfsDataDir: dataPath }))
} catch(e) {

@@ -29,2 +32,3 @@ console.log(e)

await(ipfsApi.stop())
rmrf.sync(dataPath)
}))

@@ -31,0 +35,0 @@

@@ -7,2 +7,3 @@ 'use strict'

const await = require('asyncawait/await')
const rmrf = require('rimraf')
const IpfsApis = require('ipfs-test-apis')

@@ -14,9 +15,13 @@ const Log = require('../src/log')

const dataPath = '/tmp/ipfs-log-test'
IpfsApis.forEach(function(ipfsApi) {
describe('Log with ' + ipfsApi.name, function() {
this.timeout(40000)
this.timeout(60000)
before(async(() => {
rmrf.sync(dataPath)
try {
ipfs = await(ipfsApi.start())
ipfs = await(ipfsApi.start({ IpfsDataDir: dataPath }))
} catch(e) {

@@ -30,2 +35,3 @@ console.log(e)

await(ipfsApi.stop())
rmrf.sync(dataPath)
}))

@@ -88,4 +94,2 @@

items: [
'QmUrqiypsLPAWN24Y3gHarmDTgvW97bTUiXnqN53ySXM9V',
'QmTRF2oGMG7L5yP6LU1bpy2DEdLTzkRByS9nshRkMAFhBy',
'QmQG1rPMjt1RQPQTu6cJfSMSS8GddcSw9GxLkVtRB32pMD'

@@ -103,5 +107,14 @@ ]

describe('snapshot', async(() => {
it('returns the current batch of items', async(() => {
it('returns the current head', async(() => {
assert.equal(JSON.stringify(log.snapshot), JSON.stringify(expectedData))
}))
it('returns the current heads', async(() => {
const log2 = new Log(ipfs, 'B')
await(log2.add("seven?"))
await(log.join(log2))
assert.equal(log.snapshot.items.length, 2)
assert.equal(log.snapshot.items[0], 'QmRvxvVdm9QV4nCk6wg5a6f23Jx6Jeury64inrZ9jR7SZo')
assert.equal(log.snapshot.items[1], 'QmQG1rPMjt1RQPQTu6cJfSMSS8GddcSw9GxLkVtRB32pMD')
}))
}))

@@ -149,6 +162,4 @@

const res = await(Log.fromIpfsHash(ipfs, hash))
assert.equal(res.items.length, 3)
assert.equal(res.items.length, 1)
assert.equal(res.items[0].hash, expectedData.items[0])
assert.equal(res.items[1].hash, expectedData.items[1])
assert.equal(res.items[2].hash, expectedData.items[2])
}))

@@ -164,2 +175,10 @@

it('throws an error if data from hash is not valid JSON', async(() => {
const res = await(ipfs.object.put(new Buffer('hello')))
try {
await(Log.fromIpfsHash(ipfs, res.toJSON().multihash))
} catch(e) {
assert.equal(e.message, 'Unexpected token h in JSON at position 0')
}
}))
}))

@@ -166,0 +185,0 @@ }))

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc