Socket
Socket
Sign inDemoInstall

apacheconf

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apacheconf - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

example.js

@@ -8,3 +8,3 @@ var apacheconf = require('./')

config.apacheconf.forEach(function(vh) {
config.VirtualHost.forEach(function(vh) {
if (vh.ServerName) vh.ServerName.forEach(function(d) {

@@ -11,0 +11,0 @@ domains.push(d)

@@ -6,2 +6,3 @@ var inherits = require('util').inherits

, fs = require('fs')
, path = require('path')
, glob = require('glob')

@@ -17,6 +18,13 @@

module.exports = function(filename, cb) {
module.exports = function(filename, options, cb) {
if (arguments.length == 2) {
cb = options
options = {}
}
var stream = fs.createReadStream(filename)
, parser = new Parser()
parser.serverRoot = options.serverRoot || '/usr/local/apache'
parser.file = filename

@@ -32,2 +40,6 @@ parser._stream = es.pause()

stream.on('error', function(err) {
parser.emit('error', err)
})
if (cb) {

@@ -47,7 +59,2 @@ parser.on('error', cb)

stream.pipe(es.split('\n')).pipe(parser._stream).pipe(parser, { end: false })
stream.on('error', function(err) {
parser.emit('error', err)
})
}

@@ -142,10 +149,34 @@

glob(value, function onfiles(err, files) {
if (err) return self.emit('error', err)
glob(path.resolve(this._getProp('serverRoot'), value), function(err, files) {
self._include(files.shift(), function(err) {
if (err || files.length) return onfiles(err, files)
self.resume()
})
var current
function next(err) {
if (err) {
if (err.code == 'EISDIR') {
fs.readdir(current, function(err, _files) {
if (err) return next(err)
files = _files.map(function(file) {
return path.resolve(current, file)
}).concat(files)
next()
})
} else {
self.emit('error', err)
}
return
}
if (!files.length) return self.resume()
current = files.shift()
self._include(current, next)
}
next(err)
})

@@ -219,3 +250,3 @@

self._stream.on('end', function() {
function cleanup(err) {
self._stream = origStream

@@ -225,5 +256,8 @@ self.file = origFile

cb()
})
cb(err)
}
self._stream.on('end', cleanup)
stream.on('error', cleanup)
}
{
"name": "apacheconf",
"version": "0.0.2",
"version": "0.0.3",
"description": "Apacheconf is an apache config file parser",

@@ -5,0 +5,0 @@ "main": "index.js",

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