Socket
Book a DemoInstallSign in
Socket

file-guard

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-guard

A file guard, notify you when logs increase exceeds limits

0.0.2
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

file-guard

A file guard, notify you when logs increase exceeds limits

Installation

npm install file-guard

Usage

example

'use strict'

const FileGuard = require('file-guard')
const moment = require('moment')

const file_filter = function () {
  const hour = moment().format('YYYY-MM-DD-HH')
  return `*.${hour}.log`
}
// const file_filter = '*.log'

const guard = FileGuard({
  'root': 'path/to/logs',
  'file_filter': file_filter,
  'rate_limit': {'change_count': 4, 'in_milliseconds': 1 * 60 * 1000}, // 4 changes in 1 minute
  'schedule_rule': '0 0 0 * * *'
})

guard.on('alert', function (obj) {
  console.log('on alert ', obj)
})

guard.startWatching()

parameter

root: path in which to start watching.

fileFilter: a string (e.g., *.js) which is matched using minimatch, or a function which return a matched minimatch string.

rate_limit: the max change rate limit.

schedule_rule: the rule to refresh the file_filter, see node-schedule for more.

Keywords

file-guard

FAQs

Package last updated on 19 Jan 2017

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.