@cypsela/sailplane-node
Advanced tools
Comparing version 2.1.3 to 2.1.4
{ | ||
"name": "@cypsela/sailplane-node", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "collaborative file system on ipfs", | ||
@@ -33,3 +33,3 @@ "files": [ | ||
"dependencies": { | ||
"@tabcat/orbit-db-fsstore": "^2.0.0", | ||
"@tabcat/orbit-db-fsstore": "^3.0.2", | ||
"it-all": "^1.0.2", | ||
@@ -36,0 +36,0 @@ "it-last": "^1.0.2", |
@@ -9,6 +9,6 @@ | ||
const { secondLast } = require('./util') | ||
let { FS: { errors } } = require('@tabcat/orbit-db-fsstore') | ||
const errors = { | ||
pathExistNo: (path) => new Error(`path '${path}' does not exist`), | ||
pathDirNo: (path) => new Error(`path '${path}' is not a directory`) | ||
notStarted: () => new Error('sharedfs was started') | ||
} | ||
@@ -43,2 +43,3 @@ | ||
this.fs.joinPath = this._db.joinPath | ||
this.fs.pathName = this._db.pathName | ||
this.fs.exists = this._db.exists | ||
@@ -115,2 +116,3 @@ this.fs.content = this._db.content | ||
async upload (path, source, options = {}) { | ||
if (!this.running) throw errors.notStarted() | ||
if (this.fs.content(path) !== 'dir') throw errors.pathDirNo(path) | ||
@@ -164,2 +166,3 @@ | ||
async mkdir (path, name) { | ||
if (!this.running) throw errors.notStarted() | ||
await this._db.mkdir(path, name) | ||
@@ -170,2 +173,3 @@ this.events.emit('mkdir') | ||
async mkfile (path, name) { | ||
if (!this.running) throw errors.notStarted() | ||
await this._db.mk(path, name) | ||
@@ -176,2 +180,3 @@ this.events.emit('mkfile') | ||
async write (path, cid) { | ||
if (!this.running) throw errors.notStarted() | ||
if (!validCid(this._CID, cid)) throw new Error('invalid cid') | ||
@@ -183,2 +188,3 @@ await this._db.write(path, cid.toString()) | ||
async read (path) { | ||
if (!this.running) throw errors.notStarted() | ||
return this._getCid(path) | ||
@@ -188,2 +194,3 @@ } | ||
async remove (path) { | ||
if (!this.running) throw errors.notStarted() | ||
if (!this.fs.exists(path)) throw errors.pathExistNo(path) | ||
@@ -197,2 +204,3 @@ this.fs.content(path) === 'dir' | ||
async move (path, dest, name) { | ||
if (!this.running) throw errors.notStarted() | ||
if (!this.fs.exists(path)) throw errors.pathExistNo(path) | ||
@@ -206,2 +214,3 @@ this.fs.content(path) === 'dir' | ||
async copy (path, dest, name) { | ||
if (!this.running) throw errors.notStarted() | ||
if (!this.fs.exists(path)) throw errors.pathExistNo(path) | ||
@@ -215,2 +224,3 @@ this.fs.content(path) === 'dir' | ||
async _getCid (path = '/r') { | ||
if (!this.running) throw errors.notStarted() | ||
if (!this.fs.exists(path)) throw errors.pathExistNo(path) | ||
@@ -217,0 +227,0 @@ |
17067
267
+ Added@tabcat/orbit-db-fsstore@3.1.6(transitive)
- Removed@tabcat/orbit-db-fsstore@2.0.0(transitive)