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

libnpmhook

Package Overview
Dependencies
Maintainers
6
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libnpmhook

programmatic API for managing npm registry hooks

  • 11.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
670K
decreased by-1.59%
Maintainers
6
Weekly downloads
 
Created

What is libnpmhook?

The libnpmhook package is a Node.js library for managing npm hooks. It allows you to create, list, update, and delete hooks for npm packages. This can be useful for automating workflows and integrating with other services.

What are libnpmhook's main functionalities?

Create Hook

This feature allows you to create a new npm hook for a package. The code sample demonstrates how to create a 'pre-publish' hook for 'my-package' with a specified endpoint and secret.

const libnpmhook = require('libnpmhook');

const createHook = async () => {
  await libnpmhook.create({
    name: 'my-package',
    type: 'pre-publish',
    endpoint: 'https://example.com/hook',
    secret: 'my-secret'
  }, {
    token: 'your-npm-token'
  });
};

createHook();

List Hooks

This feature allows you to list all hooks for a specific npm package. The code sample demonstrates how to list hooks for 'my-package'.

const libnpmhook = require('libnpmhook');

const listHooks = async () => {
  const hooks = await libnpmhook.ls('my-package', {
    token: 'your-npm-token'
  });
  console.log(hooks);
};

listHooks();

Update Hook

This feature allows you to update an existing npm hook for a package. The code sample demonstrates how to update the 'pre-publish' hook for 'my-package' with a new endpoint and secret.

const libnpmhook = require('libnpmhook');

const updateHook = async () => {
  await libnpmhook.update({
    name: 'my-package',
    type: 'pre-publish',
    endpoint: 'https://example.com/new-hook',
    secret: 'new-secret'
  }, {
    token: 'your-npm-token'
  });
};

updateHook();

Delete Hook

This feature allows you to delete an existing npm hook for a package. The code sample demonstrates how to delete the 'pre-publish' hook for 'my-package'.

const libnpmhook = require('libnpmhook');

const deleteHook = async () => {
  await libnpmhook.rm({
    name: 'my-package',
    type: 'pre-publish'
  }, {
    token: 'your-npm-token'
  });
};

deleteHook();

Other packages similar to libnpmhook

Keywords

FAQs

Package last updated on 03 Oct 2024

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