Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

willnode/zone-editor

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BIND9 Zone Editor Library

npm

This library allows you to edit BIND9 zone file using list of text changes. Used by DOM Cloud Bridge for BIND9 DNS zone editing.

This library is ES only. Open demo here.

Usage

npm install @domcloud/zone-editor
import { parseNS, editNS, generateNS } from '@domcloud/zone-editor';
import fs from 'fs';

const path = '/var/named/example.com.hosts';
const input = fs.readFileSync(path, { encoding: 'utf8' });
const data = parseNS(str);
const changes = ['del txt @', 'add txt @ foo=bar baz'];
if (editNS(data, changes) > 0) { // return count of changes, data is mutable
    const result = generateNS(data); // optionally pass custom template here
    fs.writeFileSync(path, result);
}

See also

About

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.