Options
All
  • Public
  • Public/Protected
  • All
Menu

edit-dns Build Status

TS library to load, save and recover DNS files

Docs

Install

NPM

npm i edit-dns

Yarn

yarn add edit-dns

Usage

import DnsEditor from 'edit-dns'

const dnsEditor = new DnsEditor('TestApp')

(async () => {
    // Saves current DNS settings
    await dnsEditor.save()

    // Load new DNS settings
    await dnsEditor.load(['1.1.1.1'])

    // Check DNS entry exists
    console.log(await dnsEditor.exists('1.1.1.1')) // true

    // Recover saved settings
    await dnsEditor.recover()

    // Check DNS entry does not exist
    console.log(await dnsEditor.exists('1.1.1.1')) // false
})()

Index

Variables

Const RESOLV_PATH

RESOLV_PATH: "/etc/resolv.conf" = "/etc/resolv.conf"

Let editor

editor: any

env

env: ProcessEnv

Const existsAsync

existsAsync: __promisify__ = promisify(exists)

Const homedir

homedir: string = os.homedir()

Const nonSudoExec

nonSudoExec: __promisify__ = promisify(exec)

Const readFileAsync

readFileAsync: __promisify__ = promisify(readFile)

Const readlinkAsync

readlinkAsync: __promisify__ = promisify(readlink)

Const tmpdir

tmpdir: string = os.tmpdir()

Const unlinkAsync

unlinkAsync: __promisify__ = promisify(unlink)

Const writeFileAsync

writeFileAsync: __promisify__ = promisify(writeFile)

Functions

Const envPaths

  • envPaths(name: string, options?: any): object
  • Parameters

    • name: string
    • Optional options: any

    Returns object

    • cache: string
    • config: string
    • data: string
    • log: string
    • temp: string

Const escapeRegExp

  • escapeRegExp(text: string): string
  • Parameters

    • text: string

    Returns string

Const linux

  • linux(name: string): object
  • Parameters

    • name: string

    Returns object

    • cache: string
    • config: string
    • data: string
    • log: string
    • temp: string

Const macos

  • macos(name: string): object
  • Parameters

    • name: string

    Returns object

    • cache: string
    • config: string
    • data: string
    • log: string
    • temp: string

Const mkkdirRecursive

  • mkkdirRecursive(targetDir: string): string
  • Parameters

    • targetDir: string

    Returns string

Const readFileAsLines

  • readFileAsLines(path: string): Promise<string[]>
  • Parameters

    • path: string

    Returns Promise<string[]>

Const windows

  • windows(name: string): object
  • Parameters

    • name: string

    Returns object

    • cache: string
    • config: string
    • data: string
    • log: string
    • temp: string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc