npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nsync-fs

v0.0.24

Published

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

Downloads

59

Readme

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