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

node-fun-bywhj

v1.0.13

Published

封装了一些nodeJS方法的常用使用function的集合

Downloads

17

Readme

##使用: npm i -S node-fun-bywhj ####001. clearCache() 清理node中的缓存

let xx = require('node-fun-bywhj')
//执行下面的方法来清除node缓存
xx.clearCache()

###002. format() 将时间类型格式化

let xx = require('node-fun-bywhj')
//执行下面的方法来清除node缓存
console.log(new Date(Date.now()).format('yyyy/MM/dd HH:mm:ss.S'))

###003. checkDirAndFile() 深度遍历目录树

let xx = require('node-fun-bywhj')
//执行下面的方法来深度遍历目录树
//参数说明 :回调函数的obj是返回的所有文件或文件夹绝对路径
//PS:想打印目录树结构,请在该包根目录中执行npm link,然后全局执行deepdir,就会得到当前项目中的目录树
xx.checkDirAndFile('某个文件夹的路径', (obj) => {
  console.log(obj);
})

###004. mkdirs(path,callback) 创建层级文件夹

let xx = require('node-fun-bywhj')
xx.mkdirs(path, (err) => {
  //第一个参数可以这样写:path.join(__dirname, './names/name/name/name')
  if(err){
    console.log(err)
  }else{
    //...
  }
})

###005. base64ToFile(data,savePart,callBack) 将去掉头部的base64字符串还原为原始文件

参数说明:data--后端接收的前端传来的JSON字符串,格式必须如下:{url:'base64格式去掉前缀',extName:'文件的扩展名'} 注:该JSON字符串中必须有url和extName这两个key;可以追加其他的key
参数说明:savePart--想要将前台传来的文件保存到哪个文件夹中(必须是绝对路径),项目中必须提前建好这个目录('./xxx/xxx')
参数说明:callBack(err,data) 路径错误,会触发err,err就是一个字符串 , data:上传成功以后的文件的全路径(物理路径)
let xx = require('node-fun-bywhj')
//用在网络请求时
if(pathname=="/postData"&&req.method=="POST"){
  let data = ''
  req.on('data',(chunk)=>{
    data+=chunk
  })
  req.on('end',()=>{
    xx.base64ToFile(data,'./upload',(err,data)=>{
      if(err){//当node写文件的时候路径错误会触发这里的err
        res.end(err)
      }else{
        res.end(JSON.stringify({
		  data,
		  msg:'上传成功'
		}))
      }
    })
  })
}

mdtohtml.js

#####进入该包根目录中,找到mdtohtml.js文件拷贝至有xxx.md文件的目录下,在该目录下命令行运行: #####01. npm i -S marked browser-sync #####02. node mdtohtml xxx.md,然后稍微修改一下.md文件,即可实现边编辑.md文件边预览对应的.html文件