Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

@coboxcoop/peer-fs

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coboxcoop/peer-fs

a multiwriter peer to peer filesystem

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

peer-fs

A multiwriter peer-to-peer filesystem. Supports Hyperdrive V10.

Usage

See test/index.test.js for examples.

API

var drive = KappaDrive(storage, key, opts)

Returns a KappaCore instance. Passes these options directly to that instance.

In addition, peerfs accepts the following optional arguments:

  • resolveFork: a function taking values of known versions of that file. If there are more than one here, there is a fork. By default, this returns the first item in the list. Overwrite this to get more fancy.

drive.replicate()

Replicate between two peer-fs instances.

drive.readFile(filename, cb)

Read asyncronously.

drive.writeFile(filename, content, cb)

Write asyncronously.

drive.createWriteStream(filename, cb)

Write to a stream.

drive.createReadStream(filename, cb)

Read file from a stream.

License

MIT

Credit

Huge credit to Karissa for ideating and writing peerfs and allowing us to run with it and complete the API.

:black_heart: :purple_heart: :green_heart:

TODO

  • Move all of the functions over from hyperdrive to the top constructor instance. (e.g., readdir, stat)
  • Improve performance and stability of index writes by using something other than JSON.
  • Allow resolveFork function to get access to the stat object of the file on that write so that it can make a more intelligent display or make better decisions about the fork
  • Allow forks to be unresolved cc @substack
  • When writing, in the link we should record the seq of the hyperdrive, and on whoHasFile, checkout to that seq if its not the latest

Keywords

multiwriter

FAQs

Package last updated on 30 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts