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

170319-haha

v1.0.0

Published

- node 主线是单线程的,进程中包含线程,一个进程中包含多个线程,node中一个进程只能包含一个线程,如果想开多个进程,node允许开子进程

Downloads

10

Readme

##单线程和多线程

  • node 主线是单线程的,进程中包含线程,一个进程中包含多个线程,node中一个进程只能包含一个线程,如果想开多个进程,node允许开子进程

##同步和异步

  • 代码从上到下执行,先走同步再走异步,异步不会阻塞主线程

##阻塞和非阻塞

  • 针对内核来说的,非阻塞是异步的前置条件

##回调

  • 用回调来解决异步编程问题

##异步 文件读写 callback 定时器
能用异步不用同步

##事件环

##node全局对象

  • 在任意地点可以直接访问的
  • 在global上挂载的都是全局对象

##js中的模块

  • (seajs cmd, requirejs amd , node commonjs)
  • cmd 就近依赖, amd 依赖前置
  • 单例(不能保证完全解决冲突,调用时调用名字过长)
  • 闭包 node中实现模块化采用的是读写

##commonjs(提高了可维护性,有利于分工协作,高内聚低耦合)

  • 如何定义一个模块 创建一个js文件,每一个文件就是一个模块,多个模块可以组成一个包
  • 如何导出一个模块 exports/module.exports
  • 如何使用一个模块 require

require 是同步的 有回调函数 有返回值 一般都是异步的

使用某个模块中是变量,可以挂载在全局下,让所有模块来使用

安装nrm源切换工具

npm i nrm -g

增加珠峰源

nrm ls
nrm add zf http://172.18.1.139
nrm use zf

npm install nodeppt -g

###http-server npm install http-server -g

启动服务 http-server -p 端口号

卸载 npm uninstall http-server -g

本地安装 初始化依赖文件(package.json) npm init -y

1.开发依赖 npm install gulp (--save-dev)或者-D

2.项目依赖 npm info jquery npm install jquery@版本号 (--save)或者-s

3.发布自己的包

  • package.json
    • name 不能和已发布的包重名
    • main里对应的主文件写一个
  • 发布要切换到npm源
  • 添加用户 有的话可以登录 npm addUser

发布 npm publish