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

filetree

v0.0.1

Published

simple,lightweight concatenation script

Downloads

5

Readme

#FileTree.js Easy navigation through your filesystem,released for public use no restrictions

#Install npm install filetree

#Why FileTree The usual course of action when trying to get a file usual evolves copy and pasting the paths or looking for a specific file or set of files in a specific location which usually involve abit of redundant work,filetree was created out of my desire to have an easy,fast way to get to different locations within the filesystem and be able to backtrack to them when without having to keep this paths within a specific variable and also to be able to retrieve specific files according to a specific criteria or name.

In Vanilla Node FS module:

  var project = "/Users/PunchBox/Projects";
  var stub_project  = project + "/stub_project";
  var filetree_project = project + "filetree";

  fs.readFile(stub_project+"/stub.js",function(err,data){
      //do something with the data;
   });

  fs.readFile(filetree_project+"/filetree.js",function(err,data){
        //do something with the data;
   });

In FileTree: Its simple a method call chain

  var fileTree = Tree.FileTree.init(~);
  fileTree.dir("Project").find("stub");

  The currrent path can be attained throught: fileTree.currentPath();


  var stub = FileFactory.spawn(fileTree.searchFiles("stub.js")).read()["stub.js"];

  You can use FileFactory to generate a file object that as a small set
  of abilities like read or write
  
  fileTree.backward().dir("filetree").files("filetree.js",function(res){
      //res will be an object containing mappings of filename: filename path
      console.log(res);
  });

 you can also do a multimove into a directory by calling dirs instead of dir:
  fileTree.root("~").dirs("Projects petprojects filetree").files()
 as you may notice,there are no forward or backward slashes,the space is the delimiter,
 you space the directory you wish to jump into in the order you want to run to,remember
 the next directory must be in the previous directory

     "files" accepts 
        - a name,
        - file extension,
        - an option callback that gets the results as its first argument,
      searchFiles will return a object with the results of the search in a
      filename:filepath fashion,its left to you to decide on how you wish
      to use the object created,you can use FileFactory as above or pass
      a callback to searchFiles which restores the chaining ability and has
      the results as its first arguments as above

     FileFactory "read" returns a object with a mapping of filename:data format,therefore
     you can access stub.js data simply by appending the name to the result

     FileFactory "write" accepts 
        - a boolean TRUE/FALSE argument to indicate appending or rewritting of the file,
        - data to write to the file in ,
        - a name to write to a specific file in the result from searchFiles,
        - a callback to pass as to callback to the fs module asyn writeFile method

  Another is writing to a large set of files meeting a criteria in searchFiles,where 
  you are not bothered about which file is to written to:

  var file = FileFactory.spawn(FileTree.root("/").dir("Library").dir("Logs").files(null,".log"))
  file.write(true,"new words onto all logs");

  FileFactory has a limit of 10 spawns as of now,it might increase as time
  goes on or if you wish to be much of a hacker you can increase it as you
  wish but it is not adviced,this was put inplace for performance
  reason,theres never a good idea in mindlessly creating new Objects.
  FileFactory only asks that once you are done with the spawns that you
  call their "destroy" method to release that object for instant reuse once
  you spawn once again 

  file.destroy() //frees this spawn for immediate use

#A simple world is a happier one.