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

hyper-sdk

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyper-sdk - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

13

package.json
{
"name": "hyper-sdk",
"version": "4.0.0",
"version": "4.0.1",
"description": "A Software Development Kit for the Hypercore-Protocol",

@@ -37,6 +37,6 @@ "type": "module",

"dns-query": "^0.11.2",
"hypercore": "^10.3.2",
"hyperswarm": "^4.3.3",
"random-access-application": "^1.0.0",
"random-access-memory": "^6.0.0",
"hypercore": "^10.5.3",
"hyperswarm": "^4.3.5",
"random-access-application": "^2.0.0",
"random-access-memory": "^6.1.0",
"z32": "^1.0.0"

@@ -46,4 +46,5 @@ },

"standard": "^17.0.0",
"tape": "^5.6.1"
"tape": "^5.6.1",
"tmp-promise": "^3.0.3"
}
}

@@ -5,2 +5,3 @@ import test from 'tape'

import b4a from 'b4a'
import { withDir } from 'tmp-promise'

@@ -12,2 +13,43 @@ const NULL_KEY = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'

test('Specify storage for sdk', async (t) => {
await withDir(async (dir) => {
const storage = dir.path
const name = 'example'
const data = 'Hello World!'
let sdk = await create({ storage })
let sdk2 = null
try {
try {
sdk2 = await create({ storage })
t.fail(new Error('Should not be able to load SDK over existing dir'))
} catch {
t.pass('Threw error when opening same storage path twice')
} finally {
if (sdk2) await sdk2.close()
}
const core1 = await sdk.get(name)
const url1 = core1.url
await core1.append(data)
await sdk.close()
sdk = await create({ storage })
const core2 = await sdk.get(name)
const url2 = core2.url
t.equal(url1, url2, 'Loaded core has same key')
const contents = await core2.get(0)
t.deepEqual(contents.toString('utf8'), data, 'Got data back from disk')
} finally {
await sdk.close()
}
}, {unsafeCleanup: true})
})
test('Load hypercores by names and urls', async (t) => {

@@ -14,0 +56,0 @@ const sdk = await create({ storage: false })

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