New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fsgod

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fsgod

Secure file sharing, hosting, and transfer

  • 1.0.5
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

##FSGOD (Alpha)

A service for securely managing, transfering, collaborating, and hosting content on your local network

The only component thus far (v 1.0.5) is the Virtual Directory Tree (VDT).

The purpose of this library is to make dynamic managing of any size of file system easy and quick.

##API

###VDT

const fsgod = require('fsgod');

// fsgod.VDT and fsgod.VirtualDirectoryTree are aliases of the same function.

fsgod.VDT('./', (vdt) => {
    var myDirectory = vdt;
    for ( var i = 0; i < myDirectory.content.length; i++ ){
        console.log(myDirectory.content[i].name);
    }
});

The above code should log the names of all the items in the directory it's currently in

The vdt object that gets passed to the callback in fsgod.VDT is the Virtual Directory Tree. fsgod.VDT recursively walks through a specified folder and builds each item into a JavaScript object and passes it back to the user in the callback. For the meantime (v1.0.5), fsgod.VDT can only be used to read and search file system data and content. If you'd like to help, email me at maui.wowie@tuta.io.

###VDT.search

fsgod.VDT('./', (vdt) => {
   var myDirectory = vdt;
   myDirectory.search('test', { content: false }, (results) => {
       console.log('Found ' + results.length + ' items');
       for (var i = 0; i < results.length; i++){
           console.log(results[i].fullPath);
       }
   });
});

The above code should find file names and directory names that contain the phrase 'test' and print their full paths.

You should notice the second argument takes an object which specifies search options, this argument is optional and simply invoking:

vdt.search('test', (results) => {
    console.log(results.length);
});

will return the search results without any filters. The filter booleans you can assign are

  1. content: true or false. decides whether or not to search file content for results
  2. names: true or false. decides whether or not to search file/directory names for results
  3. directories: true or false. decides whether or not to include directories in results
  4. files: true or false. decides whether or not to include files on search results
  5. excludes: Array. excludes results containing any strings in the excludes array

##More Info

FunctionArgumentsUsage
VDT or VirtualDirectoryTreeurl: the path to the directory you'd like to operate, done: to be called when VDT is done getting the directoryfsgod.VDT(urlToFolder, function(vdt){ })
VDT object keysUsageType
contentThe content of the item, if it's a directory it will be an array of other items. If it's a file it will be it's file contentArray or String
nameThe name of the file or directoryString
typeWill let you know if its a directory or fileString
fullPathThe full path to the itemString

Keywords

FAQs

Package last updated on 06 Feb 2018

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