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

@xism/arklet

v0.0.3

Published

A CLI tool and utility library for API requests

Readme

Arklet

一个用于 API 请求的命令行工具和工具库。

功能

  • 将剪贴板中的 curl 命令转换为 Axios 请求代码
  • 提供 API 请求工具函数,能够执行请求并保存响应

安装

# 使用 npm
npm install @xism/arklet

# 使用 pnpm
pnpm add @xism/arklet

# 使用 yarn
yarn add @xism/arklet

# 全局安装(用于命令行工具)
npm install -g @xism/arklet

命令行工具使用

# 解析剪贴板中的 curl 命令
arklet parse

使用步骤:

  1. 复制一个 curl 命令到剪贴板
  2. 运行 arklet parse 命令
  3. 生成的 Axios 请求代码会自动复制到剪贴板

库函数使用

// ESM 方式导入
import { api, jsonToString } from '@xism/arklet';

// CommonJS 方式导入
const { api, jsonToString } = require('@xism/arklet');

// 发送 API 请求并保存响应到 response.json 文件
api({
  method: 'post',
  url: 'https://api.example.com/data',
  params: {
    id: '12345',
    token: 'abcdef'
  },
  data: {
    key: 'value'
  },
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  cookies: {
    session: 'abc123',
    user: 'john_doe'
  }
});

// 将 JSON 对象转换为 Cookie/Header 字符串
const cookieString = jsonToString({
  token: '123456',
  session: 'abcdef'
});
console.log(cookieString); // 输出: token=123456; session=abcdef

API 函数参数说明

API 函数接受一个配置对象,其属性按照推荐顺序如下:

  1. method (string): 请求方法,如 'get', 'post', 'put', 'delete' 等
  2. url (string): 请求 URL
  3. params (object): URL 查询参数
  4. data (any): 请求体数据
  5. headers (object): 请求头
  6. cookies (object): Cookie 对象,会自动处理并添加到请求头中

API 函数会自动根据 Content-Type 处理请求数据,并将响应保存到当前目录下的 response.json 文件中。

遇到导入问题的解决方案

如果在使用 importrequire 导入模块时遇到 Cannot find module '@xism/arklet' 错误,可以尝试以下解决方案:

方案 1: 在使用该包的项目中创建本地链接

# 在 arklet 包目录中执行
pnpm link --global

# 在你的项目目录中执行
pnpm link --global @xism/arklet

方案 2: 使用绝对路径导入

// 使用绝对路径导入
import { api } from '/absolute/path/to/arklet/dist/lib.js';
// 或者 CommonJS 方式
const { api } = require('/absolute/path/to/arklet/dist/lib.cjs');

方案 3: 使用 npm 发布

最可靠的方式是将包发布到 npm 仓库(可以是私有仓库):

# 登录到 npm
npm login

# 发布包
npm publish --access public

开发

# 安装依赖
pnpm install

# 开发模式(监视文件变化)
pnpm dev

# 构建项目
pnpm build

# 运行 lint
pnpm lint

许可证

ISC