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

jvfs

v2.0.1

Published

JSON Virtual FileSystem : A virtual filesystem exported in JSON+base64.

Downloads

15

Readme

JSON Virtual FileSystem

I have searched over and over for a virtual filesystem module but found none that are just easy to use, so here we go.

Usage:

var jvfs_mod=require("jvfs");
var jvfs=jvfs_mod();
// jvfs import/export
jvfs.importfile(path2jvfs); // import jvfs instance from a file
jvfs.exportfile(path2jvfs); // export a jvfs instance to a file
jvfs.exportfs();            // obtain base64 encoded json encoded result of the jvfs
jvfs.importfs(b64code);     // import base64 encoded json encoded data of a jvfs filesystem

New permissions system:

var jvfs_mod=require("jvfs");
var jvfs=jvfs_mod(true);                // optional bool oftrue, toenable the permissions system
// permissions users
jvfs.perms.adduser({user:"user"});      // add a user to the permissions system
jvfs.perms.deluser("user");             // delete a user from the permissions system
// read permissions
jvfs.perms.read.aod(user,bool);         // true = prefer to check allowed over denied access for reading
jvfs.perms.read.add.allow(user,path);   // add an allowed path fora user
jvfs.perms.read.add.deny(user,path);    // add a denied pathfora user
jvfs.perms.read.del.allow(user,path);   // delete an allowed path for a user
jvfs.perms.read.del.deny(user,path);    // delete a denied path for a user
// write permissions
jvfs.perms.write.aod(user,bool);        // true = prefer to check allowed over denied access for writing
jvfs.perms.write.add.allow(user,path);  // add an allowed path fora user
jvfs.perms.write.add.deny(user,path);   // add a denied pathfora user
jvfs.perms.write.del.allow(user,path);  // delete an allowed path for a user
jvfs.perms.write.del.deny(user,path);   // delete a denied path for a user
// jvfs import/export
jvfs.importfile(path2jvfs);             // import jvfs instance from a file
jvfs.exportfile(path2jvfs);             // export a jvfs instance to a file
jvfs.exportfs();                        // obtain base64 encoded json encoded result of the jvfs
jvfs.importfs(b64code);                 // import base64 encoded json encoded data of a jvfs filesystem
// File commands
jvfs.writefile(path,value,user);        // true - false , user needed if permissions enabled
jvfs.readfile(path,user);               // contents - false , user needed if permissions enabled
jvfs.deletefile(path,user);             // true - false , user needed if permissions enabled
// Folder commands
jvfs.mkdir(path,user);                  // true - false , user needed if permissions enabled
jvfs.readdir(path,user);                // list of files in path - false , user needed if permissions enabled
jvfs.rmdir(path,user);                  // true - false , user needed if permissions enabled
// File + Folder commands
jvfs.type(path,user);                   // file - folder - false , user needed if permissions enabled
jvfs.exists(path,user);                 // true - false , user needed if permissions enabled
jvfs.resolve(path);                     // cleaned relative path
jvfs.parent(path);                      // returns relative path to supposed parent folder of path

path is relative to its virtual "root", so if no / is prepended, it will auto prepend to accomodate for relative paths

Exmple:

var jvfs=require("jvfs");               // load module
var fs=jvfs(true);                      // create a vfs with permissions enabled
fs.perms.adduser({user:"root"});        // add a new user to permissions system
fs.perms.write.aod(true);               // enable allow over deny checking
fs.perms.write.add.allow("root","/");   // allow to access path /
fs.mkdir("/folder1","root");            // returns true