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 🙏

© 2026 – Pkg Stats / Ryan Hefner

artemis-header-sign

v1.0.3

Published

aretmis-header-sign 由官方提供的方法,用于请求过程中在header添加签名的请求信息

Downloads

12

Readme

使用说明

open8200 aretmis header sign SDK for node.js

aretmis-header-sign 由官方提供的方法,用于请求过程中在header添加签名的请求信息

引入

npm install artemis-header-sign;
// commonjs
var client = require('artemis-header-sign');
// es6
import client from 'artemis-header-sign';

API

/**
 * @param {String} appKey
 * @param {String} secret
 */
var signHeader = client(appKey, secret).signHeader;

/**
 * @param {String} url 请求url
 * @param {JSON} urlParams 请求url中的参数
 * @param {String} method 请求方式 POST GET DELETE PUT
 * @param {JSON} headers 请求头,比如 { 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8' }
 * @param {JSON} params form表单的请求参数,比如get请求的query和post请求的body { 'a': 1, 'b': 2 }
 * @param {JSON} data 非form请求数据的参数
 * 
 * @return {JSON} header 应用于请求时的header
 */
var header = signHeader(url, urlParams, method, headers, params, data);

示例

使用 npm 安装 axios 包

npm install axios
var axios = require('axios');
var client = require('artemis-header-sign');

// 注: 当前appKey仅供调试接口,尽可以调通 /api/artemis/v1/plus 和 /api/artemis/v1/minus 接口
var signHeader = client('23967750', 'BZcz3VlqL1DVhWeF1boE').signHeader;

/**
 * post请求,form传参调用方法
 * signHeader(...args)
 * @param method: 'post'
 * @param params { a: 1, b: 2}
 */
axios.request({
    url: 'https://open8200.hikvision.com/artemis/api/artemis/v1/plus',
    params: {
        a: 1,
        b: 2
    },
    method: 'post',
    headers: signHeader('https://open8200.hikvision.com/artemis/api/artemis/v1/plus', null, 'post', null, { a: 1, b: 2 }, null)
}) ...
axios.post('https://open8200.hikvision.com/artemis/api/artemis/v1/plus', null, {
    params: {
        a: 1,
        b: 2
    },
    headers: signHeader('https://open8200.hikvision.com/artemis/api/artemis/v1/plus', null, 'post', null, { a: 1, b: 2 }, null)
}) ...

/**
 * get请求,form传参调用方法
 * signHeader(...args)
 * @param method: 'get'
 * @param params { a: 1, b: 2}
 */
axios.get('https://open8200.hikvision.com/artemis/api/artemis/v1/minus', {
    params: {
        a: 1,
        b: 1
    },
    headers: signHeader('https://open8200.hikvision.com/artemis/api/artemis/v1/minus', null, 'get', null, { a: 1, b: 1 }, null)
}) ...

/**
 * post请求中,参数为非form的请求,
 * @param method 'post'
 * @param params 如果存在form参数,在此处传
 * @param data 非form参数,在此处传参 
 * @param header 需要添加自定义header时 { 'Content-Type': 'application/json;charset=UTF-8' }
 */
axios.request({
    url: 'https://open8200.hikvision.com/artemis/api/vms/v1/setStatus',
    data: [{ apiId: 71, status: "ONLINE" }],
    method: 'post',
    headers: signHeader('https://open8200.hikvision.com/artemis/api/vms/v1/setStatus', null, 'post', 
            {
                'Content-Type': 'application/json;charset=UTF-8'
            },
            null, [{ apiId: 71, status: "ONLINE" }])
}) ...
axios.post('https://open8200.hikvision.com/artemis/api/vms/v1/setStatus', [{ apiId: 71, status: "ONLINE" }], {
    headers: signHeader('https://open8200.hikvision.com/artemis/api/vms/v1/setStatus', null, 'post',
            {
                'Content-Type': 'application/json;charset=UTF-8'
            }, 
            null, [{ apiId: 71, status: "ONLINE" }])
}) ...

/**
 * url中存在参数时,在请求地址中,需要将appKey替换成请求的具体参数,在signHeader中,传入第二个参数urlParams,且key对应url中的名称
 * @param urlParams { appKey: '22501409' }
 */
axios.get('https://open8200.hikvision.com/artemis/api/artemis/v1/agreementService/securityParam/appKey/22501409' /* appkey 被替换 */, {
    headers: signHeader('https://open8200.hikvision.com/artemis/api/artemis/v1/agreementService/securityParam/appKey/{appKey}',
            {
                appKey: '22501409'
            },
            'get', null, null, null)
}) ...