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

fsfb

v0.0.7

Published

file system feedback : watch files change and execute a command

Downloads

5

Readme

FSFB - (File System FeedBack)

使用nodejs开发的一个小工具, 用于监测文件系统变化并执行一个指定的命令行命令

在最初的开发过程中,本来的目的是想实现一个自动实时的文件同步工具. 将一些目录内容实时同步到远端的服务器和开发机上. 但考虑使用scp和rsync的条件下, 唯一需要的就是监测文件变化. 并产生一个通知. 于是便在设计上进行了终级简化. 最终变为现在这个小的命令行工具. 用于配合rsync,scp等标准命令行工具使用.

Change log

  • Version 0.0.1 ~ 0.0.6

    fix bug

  • Version 0.0.7

    添加 --target 参数用于明确指定需要监视的目录名.

    添加 --busy-ignore 参数用于解决一些文件变动间隔时间过短而处理时间较长而造成的处理堆叠问题.


Install

npm install fsfb -g

Usage

  1. fsfb help - 显示帮助信息

  2. fsfb "dirname" | --target="dirname" [ --exec="commend Tpl" | --exec-tpl-file="file path" [ --charset=utf-8 ]] [ --enable-log ] [ --version | version ] [ --help | help ]

     Params :
    
     dirname - 将进行监视的目录名,当第一个参数未指定参数名时, 认为是target,如果后面指定了--target将会被覆盖.
    	
     --target - 将进行监视的目录名. (>= v_0.0.7)
    	
     --busy-ignore - 当一次执行未完成时,忽略后续的执行请求. (>= v_0.0.7)
    	
     --enable-log  显示一些调式信息.大部份情况下没用.
    	
     --exec 指定命令行模版, 当文件系统产生变化时, 将替换变量值后产生的一个完整的命令行指令并直接执行.
    	
     --exec-tpl-file 从文件读取命令行模版, *考虑性能问题, 在启动监视后,不再读取tpl-file文件变化.
    	
     --charset 指定tpl-file的文件编码,默认为utf-8
    	
     --version 显示版本信息

Tips : 关于--busy-ignore , 在处理一些耗时操作时, 添加这个参数将后续请求忽略有可能是必要的. 但是也可能造成一些必要的操作被忽略,所以使用时应当小心评估使用场景. 在未来会添加执行周期限制用于解决这个问题

支持的替换标记 : {xxx}

{type} - change type of the file system, 
	possible value: "modify", "newfile", "rmfile", "mkdir", "rmdir" 

{fname} - filename,

{dirname} - relative path,

{fulldir} - full path(AP),

{fullname} - full path and file name.

Demo

Basic demo

> fsfb ./target --exec="echo {type} : {dirname} {fname}, {fulldir}, {fullname}"


 Welecom to use the fs_feedback. 
 ------------------------------- 

modify : ./target b.js, /Users/baidu/git/fsfb/target, /Users/baidu/git/fsfb/target/b.js
mkdir : ./target qqq, /Users/baidu/git/fsfb/target, /Users/baidu/git/fsfb/target/qqq
newfile : ./target/qqq asdf.js, /Users/baidu/git/fsfb/target/qqq, /Users/baidu/git/fsfb/target/qqq/asdf.js
newfile : ./target/qqq asdf.js, /Users/baidu/git/fsfb/target/qqq, /Users/baidu/git/fsfb/target/qqq/asdf.js
rmfile : ./target/qqq asdf.js, /Users/baidu/git/fsfb/target/qqq, /Users/baidu/git/fsfb/target/qqq/asdf.js

Working with rsync

First all , configure your rsync server. you can google that 'how to configure rsync server'

And the second step , write a sample script to sync your documents to remote server with rsync commend , just like this :

#!/bin/sh

# format log
logTpl="+[%H.%M.%S.%s] sync data to $hostname"

hostname='you server address'
rsyncUserName='youname'
rsyncPort=portnumber

# run the rsync. 
rsync -vrtz --delete --progress --password-file=you_rsync_pwd_file workingdir rsync://$rsyncUserName@$hostname:$rsyncPort/remotedir/

#log time
date "$logTpl"

The last thing, run the scrip by fsfb.

>fsfb . --exec=upwww.sh

Welecom to use the fs_feedback. 
------------------------------- 


sending incremental file list
dev_depends/TestData.php
      9,297 100%    8.20MB/s    0:00:00 (xfr#1, to-chk=42/99)

sent 2,353 bytes  received 238 bytes  1,727.33 bytes/sec
total size is 5,512,520  speedup is 2,127.56
[11.37.21.1419219441] sync data to remote.server.me

......