npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

ns1

v0.1.15

Published

NS1.com JS API

Downloads

315

Readme

NS1 JS API

This project is in maintenence status.

Build Status

This is a high level JS client for NS1.com's REST API. Works as a Node.js module, tested on Node v 5+. Requires an NS1 account w/ an API key.

Using Gitflow so most up-to-date version will be in the develop branch.

Check out our API documentation at http://ns1.github.io/ns1-js

All method signatures reflect endpoints from the NS1 REST API, documentation available at https://ns1.com/api

Installation

$ npm install -s ns1

TLDR Example Usage

All methods return A+ style promises.

var NS1 = require('ns1')

NS1.set_api_key([your api key])

NS1.Zone.find().then(function(zones) {
  console.log(zones) //=> Array of NS1.Zone objects
})

NS1.Zone.find('yourzone.com').then(function(zone) {
  console.log(zone) //=> NS1.Zone object of just the zone
  zone.update({ zone: 'anotherdomain.com' }).then(function(zone) {
    console.log(zone) //=> NS1.Zone object w/ updated info
  })
})

NS1.Zone.create({ zone: 'yourzone.com' }).then(function(zone) {
  console.log(zone) //=> Your newly created zone
})

new NS1.Zone({ zone: 'yourzone.com' }).save().then(function(zone) {
  console.log(zone) //=> same as above
})

Code Usage

All objects (with the exception of NS1Request and RestResource) follow the resource concept and have static find and create methods for retrieving and creating objects of those types, respectively. For some objects, find can be passed with no arguments to get all objects of that data type, e.g. NS1.Zone.find().

Once you've retrieved an object from the server, you can use update and pass an object of values you'd like to update, or you can adjust the variables on the object's attributes object, and then call save.

All method signatures follow the NS1 API, so whatever is passed to "find" a record via GET requests listed on the api is the required argument for a find method call.

Some examples:

var NS1 = require('ns1')

NS1.set_api_key([your api key])

// find a record, records require zone + type info in string
NS1.Record.find('zone.com/www.zone.com/A')
.then(function(record) {
  return record.update({
    ttl: 300
  })
}).then(function(record) {
  console.log(record.attributes.ttl) // ==> 300
})

// adding an email to a notification list
NS1.NotificationList.find(...)
.then(function(list) {
  list.attributes.notify_list.push({
    "config": {
      "email": "[email protected]"
    },
    "type": "email"
  })
  return list.save()
})

// manually send a request to the API
new NS1.NS1Request('get', '/zones/zone.com/www.zone.com/A')
.then(function(zone) {
  ...
})

Contributions

Pull Requests and issues are welcome. See the NS1 Contribution Guidelines for more information.