在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:cypsela/sailplane-node开源软件地址:https://github.com/cypsela/sailplane-node开源编程语言:JavaScript 100.0%开源软件介绍:sailplane-nodecollaborative file system on ipfs This package was built to enable collaborative file storage similar to popular consumer faced cloud storage. It uses a custom orbit-db store named orbit-db-fsstore to map file paths to IPFS content ids and calculates directory paths from contained file content ids. Things to Note:
Install
APIcheck out ./test for examples SailplaneNode API (out of date).create(orbitdb, [options])
orbitdb: an instance of OrbitDB [options]: {Object} options to be used by the sailplane instance; no options defined yet const sailplane = await Sailplane.create(orbitdb, {})
.determineAddress(name, [options])
name: {String} naming the orbitdb filesystem store [options]: {Object} options passed to orbitdb.determineAddress const address = await sailplane.determineAddress('superdrive', {})
.mount(address, [options])
address: {OrbitDBAddress or String} address of an FSStore [options]: {Object} options passed to orbitdb.open and SharedFS.create const sharedfs = await sailplane.mount(address, {})
SharedFS API.create(fsstore, [options])
sailplane.mount insteadThis method should not be directly called by users, usefsstore: an instance of FSStore [options]: {Object} options to be used by the sharedfs instance [options.onStop]: {Function} called and awaited before the sharedfs instance is stopped with sharedfs.stop. Used by sailplane.mount. [options.autoStart]: {Boolean} whether to await sharedfs.start before returning sharedfs instance. [options.loadDb]: {Boolean} whether calling sharedfs.start should load the fsstore history. const sharedfs = await SharedFS.create(orbitdb, {})
.start()
Starts the sharedfs instance. Depending on sharedfs.options start may be called automatically and load fsstore history. await sharedfs.start()
.stop([options])
[options]: {Object} options to be used [options.drop]: {Boolean} whether to call .drop on the fsstore Stops the sharedfs instance. Using the sharedfs instance after calling .stop could result in an error. await sharedfs.stop()
.upload(path, source)
path: {String} a string usable as an fsstore path. Every path must be a child of '/r'. source: {data source} this is handed directly to ipfs.add Upload folders and files to ipfs and add references to them in the fsstore. await sharedfs.upload('/r', source)
.read(path)
path: {String} path of filesystem to read const cid = await sharedfs.read('/r')
.remove(path)
path: {String} path of filesystem to remove Removes a file or folder recursively at path. await sharedfs.remove('/r')
.fs.joinPath(path, name)Creates a new path by adding path and name .fs.exists(path)Returns whether path exists in filesystem .fs.content(path)Returns content type at path .fs.read(path)Returns data stored path .fs.tree(path)Returns all paths under path .fs.ls(path)Returns all paths directly under path |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论