Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

eden-folder

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eden-folder

Eden Node JS Folder Methods

latest
Source
npmnpm
Version
0.0.32
Version published
Maintainers
1
Created
Source

#Folder

DESCRIPTION

Build Status

General

Installation

npm install eden-folder

Usage

var folder = require('eden-folder');

Methods

copy

 this copy(__dirname + '/tie');

Copy folder to path

Parameters

  • __dirname + '/tie' - string

Returns

this

Example

Code
  var parent2 = folder(__dirname + '/foo');

    parent2.copy(__dirname + '/tie', function(error));
folder().copy(error);
Outputs
null

getFiles

 string getFiles(folder(__dirname));

Returns the files

Parameters

  • folder(__dirname) - string (specific path of files)

Returns

string

Example

Code
  var parent  = folder(__dirname);

    parent.getFiles(null, true, function(error, files));
folder().getFiles(error);
files[0].getName();
files[1].getName();

    parent.getFiles(function(error, files));
folder().getFiles(error);
files[0].getName();
files[1].getName();

    parent.getFiles(/folder/ig, function(error, files));
files[0].getName();
files.length;


Outputs
null
'folder.js'
'mocha.opts'

null
'folder.js'
'mocha.opts'

'folder.js'
1

getFolders

 string getFolders(folder(__dirname));

Returns the folders in the path

Parameters

  • folder(__dirname) - string (specific path of folder)

Returns

string

Example

Code
  var parent  = folder(__dirname);

    parent.getFolders(null, true, function(error, folders));
folder().getFolders(error);
folders[0].getName();
folders[1].getName();
folders[2].getName();

    parent.getFolders(function(error, folders));
folder().getFolders(error);
folders[0].getName();

    parent.getFolders(/bar/ig, function(error, folders));
folder().getFolders(error);
folders.length;
Outputs
null
'foo'
'bar'
'zoo'

null
'foo'

null
0

getName

 string getName(folder(__dirname + '/foo/bar/zoo'));

Returns just the file name

Parameters

  • folder(__dirname + '/foo/bar/zoo') - string (specific path of root folder)

Returns

string

Example

Code
  var item  = folder(__dirname + '/foo/bar/zoo');

item.getName();
Outputs
'zoo'

getParent

 string getParent(folder(__dirname + '/foo/bar/zoo'));

Returns the folder path

Parameters

  • folder(__dirname + '/foo/bar/zoo') - string (folder before the root file)

Returns

string

Example

Code
  var item  = folder(__dirname + '/foo/bar/zoo');
  var parent  = folder(__dirname);
  var sep     = require('path').sep;

item.getParent().split(sep).pop();
Outputs
'bar'

getPermissions

 number getPermissions();

Returns numeric permissions

Parameters

Returns

number

Example

Code
  var item  = folder(__dirname + '/foo/bar/zoo');

item.getPermissions() >= 600;
Outputs
true

getTime

 number getTime();

Returns the last updated time in unix format

Parameters

Returns

number

Example

Code
  var item  = folder(__dirname + '/foo/bar/zoo');

item.getTime() > 0;
Outputs
true

isFolder

 bool isFolder();

Returns true if the path is a real folder in the system

Parameters

Returns

bool

Example

Code
  var item  = folder(__dirname + '/foo/bar/zoo');

item.isFolder();
Outputs
false

mkdir

 this mkdir(Callback);

Create folder with the specified path

Parameters

  • callback

Returns

this

Example

Code
  var item  = folder(__dirname + '/foo/bar/zoo');

    item.mkdir(0777, function(error));
folder().mkdir(error);
Outputs
null

remove

 this remove();

Removes the folder

Parameters

Returns

this

Example

Code
  var parent2 = folder(__dirname + '/foo');

folder().remove(error);

    folder(_dirname + '/tie').remove(function(error));
folder().remove(error);
Outputs
null
null

truncate

 this truncate();

Empties the contents in the given folder

Parameters

Returns

this

Example

Code
  var parent2 = folder(__dirname + '/foo');

    parent2.truncate(function(error));
folder().truncate(error);
Outputs
null

Keywords

eden

FAQs

Package last updated on 01 Jun 2015

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