Socket
Socket
Sign inDemoInstall

cdnjs-api

Package Overview
Dependencies
3
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cdnjs-api

Unofficial API Wrapper for cdnjs.com


Version published
Maintainers
1
Install size
524 kB
Created

Readme

Source

:globe_with_meridians: Unofficial CDNJS API

Search cdnjs libraries just a snap - More Information about API https://cdnjs.com/api

Install

Using NPM
npm install cdnjs-api --save

Using Yarn
yarn add cdnjs-api

Usage

cdnjs.search|lib|versions|files(query: string, options?: Object)

const cdnjs = require('cdnjs-api')

// Search jquery
cdnjs.search('jquery').then(result => {
  console.log(result)
})

// Display custom fields
// See available fields on documentation below
cdnjs.search('jquery', {
  fields: {
    description: true,
    version: true
  }
}).then(result => {
  console.log(result)
})

// Print HTML instead of JSON
cdnjs.search('jquery', {
  json: false
}).then(result => {
  console.log(result)
})

// Get jquery data
cdnjs.lib('jquery').then(result => {
  console.log(result)
})

// Get jquery versions
cdnjs.versions('jquery').then(result => {
  console.log(result)
})

// Get jquery files
cdnjs.files('jquery').then(result => {
  console.log(result)
})

// Get jquery version 1.12.0 files
cdnjs.files('jquery@1.12.0').then(result => {
  console.log(result)
})

API

MethodsDescription
searchSearch with query
libGet library data
versionsGet library versions
filesGet library files

Default Options

{
  fields: {
    version: false,
    description: false,
    homepage: false,
    keywords: false,
    license: false,
    repository: false,
    autoupdate: false,
    author: false,
    assets: false
  },
  json: true
}

Available Fields

  • version
  • description
  • homepage
  • keywords
  • license
  • repository
  • autoupdate
  • author
  • assets

License

MIT © oknoorap

Keywords

FAQs

Last updated on 08 Aug 2017

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