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

@tabcat/orbit-db-fsstore

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tabcat/orbit-db-fsstore - npm Package Compare versions

Comparing version 3.0.2 to 3.1.0

2

package.json
{
"name": "@tabcat/orbit-db-fsstore",
"version": "3.0.2",
"version": "3.1.0",
"description": "a custom orbit-db store representing a file system",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -27,3 +27,8 @@

// creates an fs with a root dir
const setRoot = (fs) => fs.set('/r', { type: cTypes.dir })
const defaultRoot = '/r'
const setRoot = (fs) => {
fs.root = defaultRoot
return fs.set(defaultRoot, { type: cTypes.dir })
}
const root = (fs) => fs.root
const create = (state) => setRoot(new Map(state))

@@ -51,15 +56,20 @@

const isOver = (p1, p2) => `${p1}/` === p2.slice(0, p1.length + 1)
const isOneHigher = (p1, p2) => p1.split('/').length + 1 === p2.split('/').length
const sortFn = (o, t) => o.toLowerCase().localeCompare(t.toLowerCase())
function tree (fs, path) {
const a = []
for (const p of fs.keys()) {
if (`${path}/` === p.slice(0, path.length + 1)) {
a.push(p)
}
if (isOver(path, p)) a.push(p)
}
return a
return a.sort(sortFn)
}
function ls (fs, path) {
return tree(fs, path)
.filter(p => path.split('/').length + 1 === p.split('/').length)
const a = []
for (const p of fs.keys()) {
if (isOver(path, p) && isOneHigher(path, p)) a.push(p)
}
return a.sort(sortFn)
}

@@ -202,2 +212,3 @@

ops,
root,
create,

@@ -204,0 +215,0 @@ exists,

@@ -72,7 +72,7 @@

this.pathName = pathName
this.exists = (path = '') => fs.exists(this._index.get(), path)
this.content = (path = '') => fs.content(this._index.get(), path)
this.read = (path = '') => fs.read(this._index.get(), path)
this.tree = (path = '') => fs.tree(this._index.get(), path)
this.ls = (path = '') => fs.ls(this._index.get(), path)
this.exists = (path = '') => fs.exists(this.index, path)
this.content = (path = '') => fs.content(this.index, path)
this.read = (path = '') => fs.read(this.index, path)
this.tree = (path = '') => fs.tree(this.index, path)
this.ls = (path = '') => fs.ls(this.index, path)

@@ -84,2 +84,4 @@ this.paramChecks = paramChecks(this)

get root () { return fs.root(this.index) }
_addOp ({ op, ...payload }) {

@@ -86,0 +88,0 @@ const cType = op.slice(-3) === 'DIR' ? fs.cTypes.dir : fs.cTypes.file

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