fs-grep
Contents of the file grep
Last updated 4 years ago by xuexb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install fs-grep 
SYNC missed versions from official npm registry.

fs-grep

Contents of the file grep


code style fecs NPM Version NPM Downloads Linux Build Windows Build Test Coverage Dependencies DevDependencies

Cli

# install
[sudo] npm install -g fs-grep

# pattern => 需要匹配的内容,如果有空格需要使用引号包裹
# files => 以glob的方式,比如"./**/*"、"./**/*.ext"等
fs-grep <pattern> [files]

# 例子:查找当前目录下的包含所有test的文件
fs-grep test

# 例子:查找所有.md
fs-grep test "./**/*.md"

# 例子:搜索词高亮
fs-grep --color test

Api

使用npm install fs-grep安装

.exec

var read = fsGrep.exec(pattern, files);

read.on('line', function (path, index, content) {
    // path => 文件路径
    // index => 文件行数
    // content => 匹配的内容
});


read.on('end', function (data) {
    data = [
        {
            path: '',
            data: [
                {
                    index: '',
                    content: ''
                }
            ]
        }
    ];
});

Current Tags

  • 0.0.5                                ...           latest (4 years ago)

5 Versions

  • 0.0.5                                ...           4 years ago
  • 0.0.4                                ...           4 years ago
  • 0.0.3                                ...           4 years ago
  • 0.0.2                                ...           4 years ago
  • 0.0.1                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |