Socket
Socket
Sign inDemoInstall

cloudflare-dns

Package Overview
Dependencies
25
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudflare-dns

Extended CloudFlare API


Version published
Maintainers
1
Weekly downloads
6
decreased by-62.5%
Install size
4.53 MB

Weekly downloads

Readme

Source

Extended CloudFlare API

This was made with the intent of extending CloudFlare's Node.JS API with more functionality. Right now I'm only extending their DNS functionality in order to support updating existing records.

DNS API

import CloudFlare from 'cloudflare-dns'
const cf = new CloudFlare({ token: 'my-token' })

Records

Records may be expressed in different ways.

String

const record = 'example.com IN SSHFP 1 1 123456'

Object

const record = {
	type: 'A',
	name: 'example.com',
	content: '127.0.0.1'
}

Object (with data, for complex records)

// example.com IN SSHFP 1 2 123456
const record = {
	type: 'SSHFP',
	name: 'example.com',
	data: {
		algorithm: 1,
		type: 2,
		content: '123456'
	}
}

Operations

Create

Creates a new record.

await cf.dns.create('my-zone', record)

Update

Updates an existing record or creates a new one.

await cf.dns.update('my-zone', record)

Update is tricky: it will match existing records based on the name and type properties on most protocols. Some exceptions exist, though, where we'll need the content and/or data properties. See the following table to understand more.

ProtocolContent AContent BMatch
SSHFP1 1 1234561 1 654321yes
SSHFP1 1 1234561 2 654321no
SSHFP1 1 1234562 1 654321no

Keywords

FAQs

Last updated on 03 Feb 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc