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

folders

v0.0.7

Published

Synthetic file system for your local and remote servers

Downloads

37

Readme

Folders

The Folders node.js package provides a filesystem abstraction for synthetic file systems.

Folders may be based on a local file system, a remote file system, or another synthetic file system as provided by a module. Additional providers are available and can be installed via "npm install folders-modulename".

For example: "npm install folders-ftp" will install an FTP module. The module comes with an FTP client and server, enabling Folders to use Folders on a remote system, and to provide access to folders over the FTP protocol to clients.

You need to install the gulp tasker module by command "npm install --global gulp". Then you can go to src and run "gulp test". That will run the test directory test cases.

The core project is available under the Apache 2.0 or MIT licenses. Modules and their dependencies may have different license requirements.

Folders Provider API

Folders providers must implement the following methods:

Constructor

Provider constructor, could pass the special option/param in the opts param.

/**
 * @param Prefix, folders prefix
 * @param opts, options, example connectionString for ftp
 */
Provider(prefix, opts)

some options for exist folders provider.

  • folders-ftp options
{
	// the connection string, format: ftp//username:password@host:port
	connectionString : "ftp://test:123456@localhost:3333",

	// the option to start up a embedded server when inin the folders, used in test/debug
	enableEmbeddedServer : true
}
  • folders-ssh options
{
	// the connection string, format: ssh//username:password@host:port
	connectionString : "ssh://test:123456@localhost:3334",

	// the option to start up a embedded server when inin the folders, used in test/debug
	enableEmbeddedServer : true
}
  • folders-hdfs options
{
	// the base url address for hdfs instance
	baseurl : "http://webhdfs.node/webhdfs/v1/data/",

	// the username to access the hdfs instances
	username : 'hdfs'
}

###ls

ls dir

/**
 * @param uri, the uri to ls
 * @param cb, callback function. 
 */
ls(uri, cb)

//the param of the cb function
/**
 * @param files ,the file information.
 * @param err, the err message, the files will be null if err, please check the err before using the files information.
 */
cb(files,err);

###cat

cat file

/**
 * @param uri, the file uri to cat 
 * @param cb, callback function. 
 */
cat(uri, cb);

//the callback function
/**
 * @param result, json object including the stream, size, name information. example {stream: readableStream, size: 1024, name: "testfile"}
 * @param err, the err message of callback, the result param will be null if error, please check the err before using the result information.
 */
 cb(result,err)

write

write file to file system

/**
 * @param path, string, the path 
 * @param data, the input data, 'stream.Readable' or 'Buffer'
 * @param cb, the callback function
 */
write(path,data,cb);

//the callback function
/**
 * @param result, string message, example, "write success"
 * @param err, the err message of callback, the result param will be null if error, please check the err before using the result information.
 */
cb(result,err);

Union Folders API

This is a unique interface which can serve content from several providers. File systems are listed as named folders in the root directory.

For example, to setup a union file system testing several folders providers:

npm install folders
npm install folders-ftp
npm install folders-ssh
var mounts = [
	{ "stub" : fio.provider("stub") },
	{ "local" : fio.provider("local") },
	{ "memory" : fio.provider("memory") },
	{ "ftp" : fio.provider("ftp", {
                connectionString : "ftp://test:123456@localhost:3333",
                enableEmbeddedServer : true
        }) },
        { "ssh" : fio.provider("ssh", {
                connectionString : "ssh://test:123456@localhost:3334",
                enableEmbeddedServer : true
        }) }
];

var Fio = require('folders');
var unionfs = new ((Fio.union())(fio, mounts, {
	"view" : "list"
}));

unionfs.ls('.', function(data) {
	// will list the five modules listed as root folders.
});