Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rd

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rd - npm Package Compare versions

Comparing version 0.0.2 to 1.0.0

index.js

42

package.json
{
"name": "rd",
"main": "./lib/index.js",
"version": "0.0.2",
"description": "Read all directory recursively 列出(遍历)目录下的所有文件,包括子目录",
"author": "leizongmin <leizongmin@gmail.com> (http://ucdok.com)",
"name": "rd",
"version": "1.0.0",
"description": "Read all directory recursively 列出(遍历)目录下的所有文件,包括子目录",
"main": "index.js",
"files": [
"index.js"
],
"scripts": {
"test": "npm run lint && mocha -t 5000",
"test-cov": "istanbul cover _mocha --report lcovonly -- -t 5000 -R spec && cat ./coverage/lcov.info | coveralls",
"lint": "eslint . --fix",
"prepublish": "npm run lint"
},
"repository": {
"type": "git",
"url": "git://github.com/leizongmin/node-rd.git"
"url": "git+https://github.com/leizongmin/node-rd.git"
},
"engines": {
"node": ">= 0.6.0"
"keywords": [
"directory",
"recursively"
],
"author": "Zongmin Lei <leizongmin@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/leizongmin/node-rd/issues"
},
"homepage": "https://github.com/leizongmin/node-rd#readme",
"devDependencies": {
"mocha": ">= 1.2",
"should": "~1.2.2"
},
"scripts": {
"test": "mocha -t 5000"
"mocha": "^3.1.2",
"coveralls": "^2.11.14",
"eslint": "^3.8.1",
"eslint-config-lei": "0.0.14",
"eslint-plugin-promise": "^3.3.0",
"istanbul": "^0.4.5"
}
}

@@ -1,8 +0,35 @@

[![Build Status](https://secure.travis-ci.org/leizongmin/node-rd.png?branch=master)](http://travis-ci.org/leizongmin/node-rd)
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![David deps][david-image]][david-url]
[![node version][node-image]][node-url]
[![npm download][download-image]][download-url]
[![npm license][license-image]][download-url]
node-rd
=======
[npm-image]: https://img.shields.io/npm/v/rd.svg?style=flat-square
[npm-url]: https://npmjs.org/package/rd
[travis-image]: https://img.shields.io/travis/leizongmin/node-rd.svg?style=flat-square
[travis-url]: https://travis-ci.org/leizongmin/node-rd
[coveralls-image]: https://img.shields.io/coveralls/leizongmin/node-rd.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/leizongmin/node-rd?branch=master
[david-image]: https://img.shields.io/david/leizongmin/node-rd.svg?style=flat-square
[david-url]: https://david-dm.org/leizongmin/node-rd
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.6-green.svg?style=flat-square
[node-url]: http://nodejs.org/download/
[download-image]: https://img.shields.io/npm/dm/rd.svg?style=flat-square
[download-url]: https://npmjs.org/package/rd
[license-image]: https://img.shields.io/npm/l/rd.svg
# node-rd
列出(遍历)目录下的所有文件,包括子目录
## 安装
```bash
$ npm install rd --save
```
## API列表

@@ -13,3 +40,3 @@

+ `read` 开头表示返回数组结果
+ `each` 开头表示没发现一个文件均调用回调函数
+ `each` 开头表示每发现一个文件均调用回调函数 `findOne`
+ `Sync` 结尾表示是同步函数,其他表示异步函数

@@ -40,4 +67,4 @@

```JavaScript
function findOne (filename, stats) {
```javascript
function findOne(filename, stats) {
// filename 是当前文件的完整路径

@@ -50,4 +77,4 @@ // stats 是使用 fs.Stats 对象

```JavaScript
function callback (err, list) {
```javascript
function callback(err, list) {
// 如果出错,err为出错信息

@@ -64,4 +91,4 @@ // each系列函数没有list参数

```JavaScript
function pattern (filename) {
```javascript
function pattern(filename) {
// filename 是当前文件的完整路径

@@ -105,10 +132,14 @@ // 返回 true 表示该文件名符合条件

});
// 同步遍历目录下的所有js文件
rd.eachFileFilterSync('/path', /\.js$/, function (f, s) {
console.log(f);
});
```
License
=======
## License
```
Copyright (c) 2013-2014 Zongmin Lei (雷宗民) <leizongmin@gmail.com>
Copyright (c) 2013-2016 Zongmin Lei (雷宗民) <leizongmin@gmail.com>
http://ucdok.com

@@ -115,0 +146,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc