filterfile

1.0.3 • Public • Published

File Filter

Filter file on server/computer

Installation

$ npm i filterfile -S

Usage

Filters all files from the specified directory.
And distributes them to the directories specified for the extension.

File Filter API

Constructor(path);

Sets path to filter files

Arguments

  • path - string variable, path to filter files

setFilesFilter(parameters);

Sets parameters for moving certain files.

Arguments

  • parameters - object variable, stores extension data
let parameters = {
    "png": "./files/photos",
    "jpg": "./files/photos",
    "another": "./files/trash" // Any extension
}

listen(time);

Check files, every ${time} mili seconds

Arguments

  • time - int variable, sets periodicity of checking files. Auto = 100

Example

let FF = require('./index.js');
let FileFilter = new FF('./files/downloads/');
let filter = {
    "js": "./files/app/",
    "png": "./files/photos/",
    "exe": "./files/app/",
    "jpg": "./files/photos/",
    "zip": "./files/zip/",
    "py": "./files/app/",
    "another": "./files/trash/s"
}
FileFilter.setFilesFilter(filter); 
FileFilter.listen(100);

License

        (The MIT License)

Copyright (c) 2012 Near Infinity Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

none

Package Sidebar

Install

npm i filterfile

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

4.08 kB

Total Files

3

Last publish

Collaborators

  • semi4