hostapd.js
function enable(options, callback) {
  var file = options.interface + '-hostapd.conf';

  var commands = [
    'cat <<EOF >' + file + ' && hostapd -B ' + file + ' && rm -f ' + file
  ];

  Object.getOwnPropertyNames(options).forEach(function(key) {
    commands.push(key + '=' + options[key]);
  });

  return this.exec(commands.join('\n'), callback);
}
function enable(options, callback) {
  var file = options.interface + '-hostapd.conf';

  var commands = [
    'cat <<EOF >' + file + ' && hostapd -B ' + file + ' && rm -f ' + file
  ];

  Object.getOwnPropertyNames(options).forEach(function(key) {
    commands.push(key + '=' + options[key]);
  });

  return this.exec(commands.join('\n'), callback);
}
function enable ( options , callback ) { var file = options . interface + '-hostapd.conf' ; var commands = [ 'cat <<EOF >' + file + ' && hostapd -B ' + file + ' && rm -f ' + file ] ; Object . getOwnPropertyNames ( options ) . forEach ( function ( key ) { commands . push ( key + '=' + options [ key ] ) ; } ) ; return this . exec ( commands . join ( '\n' ) , callback ) ; }
The **hostpad enable** command is used to host an access point
on a specific wireless interface.

@static
@category hostapd
@param {object} options The access point configuration.
@param {function} callback The callback function.
@returns {process} The child process.
@example

var hostapd = require('wireless-tools/hostapd');

var options = {
channel: 6,
driver: 'rtl871xdrv',
hw_mode: 'g',
interface: 'wlan0',
ssid: 'RaspberryPi',
wpa: 2,
wpa_passphrase: 'raspberry'
};

hostapd.enable(options, function(err) {
// the access point was created
});
The ** hostpad enable ** command is used to host an access point on a specific wireless interface .