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 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-file-sync

v2.1.0

Published

Sync file It keeps your files synced between two directory. In other words, any change of files in one directory will automatically take place in another one.

Downloads

1,308

Readme

gulp-file-sync

NPM version Build Status Coveralls Status Dependency Status Downloads

Sync file It keeps your files synced between two directory. In other words, any change of files in one directory will automatically take place in another one.

Migration from Version 1

If you were previously passing a function as an ignore option, you'll have to replace the old function signature dir with stats. We made this change in 2.0.0.

Installation

npm install --save-dev gulp-file-sync

Usage

var gulp = require('gulp'),
    fileSync = require('gulp-file-sync');

gulp.task('sync', function() {
  gulp.watch(['src/*.*'], function() {
    fileSync('src', 'dest', {recursive: false});
  });
});

API

fileSync('source directory', 'destination directory', options)

'source directory' and 'destination directory'

type: String

Any change of files in 'source directory' will automatically take place in 'destination directory'.

options.recursive

type: Boolean

default: true

Synchronize subdirectories recursively.

options.ignore

type: string or array or regex or function

Either a string, array, regex, or function to exclude some specific files. For example:

// ignore all .log files
fileSync('source directory', 'destination directory', {
    ignore: '.log'  
})
fileSync('source directory', 'destination directory', {
    ignore: [/^\.log$/i, '.cache'] // Exclude all .log and .cache files
})
fileSync('source directory', 'destination directory', {
    ignore: /^\.log$/i 
})
fileSync('source directory', 'destination directory', {
    ignore: function(stats, file) {
        if (stats.isFile()) {
            return file === '.log';
        }
        return false;
    } 
})

options.addFileCallback

type: function(fullPathSrc, fullPathDest)

default:

var gutil = require('gulp-util');
function(fullPathSrc, fullPathDest) {
  gutil.log('File addition synced ' + fullPathDest);
}

This function is called when file was added on source directory.

  • fullPathSrc - is the path of file that was added on source directory.
  • fullPathDest - is the path of file that was copied to destination directory.

options.deleteFileCallback

type: function(fullPathSrc, fullPathDest)

default:

var gutil = require('gulp-util');
function(fullPathSrc, fullPathDest) {
  gutil.log('File deletion synced ' + fullPathDest);
}

This function is called when file was deleted on source directory.

  • fullPathSrc - is the path of file that was deleted on source directory.
  • fullPathDest - is the path of file that was deleted on destination directory.

options.updateFileCallback

type: function(fullPathSrc, fullPathDest)

default:

var gutil = require('gulp-util');
function(fullPathSrc, fullPathDest) {
  gutil.log('File modification synced ' + fullPathDest);
}

This function is called when file was updated on source directory.

  • fullPathSrc - is the path of file that was updated on source directory.
  • fullPathDest - is the path of file that was copied to destination directory.

options.beforeAddFileCallback

type: function(fullPathSrc)

This function is called before file is added on source directory.

  • fullPathSrc - is the path of file that was added on source directory.

options.beforeDeleteFileCallback

type: function(fullPathSrc)

This function is called before file is deleted on source directory.

  • fullPathSrc - is the path of file that was deleted on source directory.

options.beforeUpdateFileCallback

type: function(fullPathSrc)

This function is called before file is updated on source directory.

  • fullPathSrc - is the path of file that was updated on source directory.

License

MIT (c) 2015 Kayo Lee ([email protected])