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

gulp-cut

v1.0.7

Published

Gulp plugin - you could cut off file stream and restore it

Readme

gulp-cut

用于截取/拷贝文件流,在需要的时候再并入/覆盖文件流

INSTALL

npm install gulp-cut

API

cut(id, opt)

该方法用于截取文件流,符合参数的文件将被截取,不会在后面的文件流中出现 id为用于标记文件流的参数,如果不传则为默认的defaults opt的参数可以为:路径字符、包含路径字符的数组、正则

copy(id, opt)

该方法用于拷贝文件流,符合参数的文件将被拷贝,不会影响文件流的输出 id参数同上 opt参数同上

del(opt)

删除符合参数的文件流 opt参数同上

join(id)

该方法在截取/拷贝文件流后,用于加入回文件流 id为用于标记文件流的参数,如果不传则为默认的defaults

cover(id)

该方法在截取/拷贝文件流后,用于覆盖文件流 id为用于标记文件流的参数,如果不传则为默认的defaults

clear(id)

清空保存的文件流 id为用于标记文件流的参数,如果不传则为默认的defaults

createCut()

实例化一个新的cut对象

DEMOS

  • 截取文件流后再加入文件流的用法
var cut = require('gulp-cut');
gulp.task("test1" , function(){
    del.sync(["./dist/","./dist2/"]);

    gulp.src('./ref/**/*')
        .pipe(cut.cut('test1', ['./ref/images/**/*' , './ref/*.html']))
        .pipe(gulp.dest("./dist/"))
        .pipe(cut.join('test1'))
        .pipe(gulp.dest("./dist2/"));
});
  • 拷贝文件流后再覆盖文件流的用法
var cut = require('gulp-cut')
gulp.task("test2" , function(){
    del.sync(["./dist/","./dist2/"]);

    gulp.src('./ref/**/*')
        .pipe(cut.copy('test2', './ref/images/**/*'))
        .pipe(cut.dest("./dist/"))
        .pipe(cut.cover('test2'))
        .pipe(gulp.dest("./dist2/"));
});
  • 运用于seajs项目

lib目录下的js不需要使用transport编译,但是需要压缩,所以在进行编译前将lib目录下的js文件截取,让其他需要编译的进行编译,然后再将截取的js恢复到文件流进行压缩。

var cut = require('gulp-cut')
gulp.task('build-js' , function(){
    return gulp.src('./javascripts/**/*')
        .pipe(cut.cut('js', './javascripts/lib/**/*'))
        .pipe(transport())
        .pipe(concat(/\/app\//g))
        .pipe(modify(replaceJs))
        .pipe(cut.join('js'))
        .pipe(uglify())
        .pipe(gulp.dest(resultPath+"javascripts"));
});

tips:如果需要在多个task中使用cut,建议在每个task中用createCut()实例化一个新的cut对象,避免同时使用同一个cut对象造成数据混乱