Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ascari/hosts

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

@ascari/hosts

Utility for editing `hosts` files programmatically.

  • 0.6.0
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

hosts

A module for editing hosts files programmatically.

Install

npm i <this-git-url> --save

Usage

const hosts = require('hosts');

// Sync write to hosts file.
hosts.set('127.0.0.1', 'yourside.dev');

console.log('path', hosts.getPath());
console.log('entries', hosts.get());

API

method setPath(String path)

Set path of hosts file to modify.

method getPath() -> String

Get path set for hosts file.

method set(String ip, String hostname)

Add a new entry to hosts file.

method unset(String ip, RegExp|String [hostname])

Remove a existing entry by its ip and hostname. NOTE: Not implemented.

method get(String [ip], RegExp|String [pattern]) -> Array of Objects

Retrieve a entry by its id and hostname or a regexp pattern to match. If no arguments are set, then all entries are returned.

License

MIT

Keywords

FAQs

Package last updated on 09 May 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

  • 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