
Security News
Cline CLI npm Package Compromised via Suspected Cache Poisoning Attack
A compromised npm publish token was used to push a malicious postinstall script in cline@2.3.0, affecting the popular AI coding agent CLI with 90k weekly downloads.
buffer-request
Advanced tools
一个简单好用的HTTP请求库,适用于Buffer类型的数据请求。
同类HTTP请求库推荐。
由于只需要适配较少的情况,因此代码量非常少,就一个基础文件,你可以直接复制到自己的项目中。非常适合Serverless场景,减少容器冷启动时间。
$ npm install buffer-request
支持2种调用方式,首先引用:
const request = require('buffer-request');
第1种调用方式,直接输入请求地址和回调函数:
request(url,callback)
例如:
request('http://www.example.com',function(error,response){
if(error){
console.error(err)
}else{
console.log(response)
}
})
这种方式默认请求方法GET,无Body。如果需要更复杂的请求形式,请使用以下第2种调用方式:
request(options,callback)
例如:
let options = {
url:'http://www.example.com', // 请求地址
method:'POST', // 请求方法
headers:{}, // 请求头
body:'{"name":"ming"}', // 请求体
base64Encoded:true // 是否需要将响应主体使用base64转码
}
request(options,function(error,response){
if(error){
console.error(err)
}else{
console.log(response)
}
})
以上两种调用方式都可以,回调函数的response是一个对象,包含statusCode,statusMessage,headers,body字段,你在使用时可以直接打印查看。
FAQs
An easy and simple http client for buffer type request
We found that buffer-request demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
A compromised npm publish token was used to push a malicious postinstall script in cline@2.3.0, affecting the popular AI coding agent CLI with 90k weekly downloads.

Product
Socket is now scanning AI agent skills across multiple languages and ecosystems, detecting malicious behavior before developers install, starting with skills.sh's 60,000+ skills.

Product
Socket now supports PHP with full Composer and Packagist integration, enabling developers to search packages, generate SBOMs, and protect their PHP dependencies from supply chain threats.