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

nsync-fs

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nsync-fs

A virtual file system for Atom, synchronized with a remote physical file system

  • 0.0.24
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Weekly downloads
 
Created
Source

nsync-fs

This module is used by the Learn IDE, via the Learn IDE Tree package, to mirror a remote filesystem on the client's local machine. This is accomplished by both by maintaining a virtual filesystem that reflects the remote's full tree along with some data about each node (exposed by the included nsync.fs module), and by copying the remote files to the local disk. All of this is synchronized over a websocket connection, which can be shared by multiple processes via atom-socket.

Installation

$ npm install nsync-fs --save

Usage

Configure, then wait for the primary node to be set before using the nsync.fs module:

var nsync = require('nsync-fs');

nsync.configure({
  localRoot: '/path/to/local-mirror',
  connection: {
    url: 'wss://ide.learn.co/file_sync_server'
  }
});

nsync.onDidSetPrimary(function(data) {
  var fs = nsync.fs; 
  var stat = fs.statSync('/some/remote/path'); // stat object of remote path
})
Custom Commands

Custom commands can be passed from the server to the client, to be handled like this:

nsync.onDidReceiveCustomCommand(function(commandPayload) {
  console.log('Custom command received:', commandPayload);
});

For example, the Learn IDE's server watches a file on the remote filesystem, ~/.custom_commands.log, which can be written to by any process running on the host. It only requires that the write be a line of valid JSON with a command key:

{"command": "atom_open", "path": "/some/remote/path"}

The server then sends this line to the client, where it is parsed into an object and passed along to the callbacks defined with onDidReceiveCustomCommand. For more on this, see how custom commands are handled in the Learn IDE Tree.

Development

This project is written in coffescript, use the default gulp task to start watching ./src/ and transpiling to ./lib/:

$ git clone https://github.com/learn-co/nsync-fs.git
$ cd nsync-fs
$ npm install
$ npm link
$ gulp

FAQs

Package last updated on 27 Jul 2017

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

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