//第三题

var fs =require('fs')
var path=process.argv[2]
fs.readFile(path,function(err,data){
var lines=data.toString().split('\n').length-1;
console.log(lines)
})

 

第5题

//new module program.js
var mymodule=require('./myfile.js') var dir=process.argv[2]
var filter=process.argv[3] mymodule(dir,filter,function(err,list){
if(err)
return console.error("ddddddd") list.forEach(function(file)
{
console.log(file)
})
})
//myfile.js
var fs =require('fs')
var path=require('path') module.exports=function(dir,fileter,callback)
{
fs.readdir(dir,function(err,list){
if(err)
return callback(err)
list=list.filter(function(file){
if(path.extname(file)=='.'+fileter)
return file
})
callback(null,list)
})
}

learnyounode 题解的更多相关文章

  1. 2016 华南师大ACM校赛 SCNUCPC 非官方题解

    我要举报本次校赛出题人的消极出题!!! 官方题解请戳:http://3.scnuacm2015.sinaapp.com/?p=89(其实就是一堆代码没有题解) A. 树链剖分数据结构板题 题目大意:我 ...

  2. noip2016十连测题解

    以下代码为了阅读方便,省去以下头文件: #include <iostream> #include <stdio.h> #include <math.h> #incl ...

  3. BZOJ-2561-最小生成树 题解(最小割)

    2561: 最小生成树(题解) Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 1628  Solved: 786 传送门:http://www.lyd ...

  4. Codeforces Round #353 (Div. 2) ABCDE 题解 python

    Problems     # Name     A Infinite Sequence standard input/output 1 s, 256 MB    x3509 B Restoring P ...

  5. 哈尔滨理工大学ACM全国邀请赛(网络同步赛)题解

    题目链接 提交连接:http://acm-software.hrbust.edu.cn/problemset.php?page=5 1470-1482 只做出来四道比较水的题目,还需要加强中等题的训练 ...

  6. 2016ACM青岛区域赛题解

    A.Relic Discovery_hdu5982 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Jav ...

  7. poj1399 hoj1037 Direct Visibility 题解 (宽搜)

    http://poj.org/problem?id=1399 http://acm.hit.edu.cn/hoj/problem/view?id=1037 题意: 在一个最多200*200的minec ...

  8. 网络流n题 题解

    学会了网络流,就经常闲的没事儿刷网络流--于是乎来一发题解. 1. COGS2093 花园的守护之神 题意:给定一个带权无向图,问至少删除多少条边才能使得s-t最短路的长度变长. 用Dijkstra或 ...

  9. CF100965C题解..

    求方程 \[ \begin{array}\\ \sum_{i=1}^n x_i & \equiv & a_1 \pmod{p} \\ \sum_{i=1}^n x_i^2 & ...

随机推荐

  1. 【Java】常用POI生成Excel文档设置打印样式

    package poi_test; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi ...

  2. 被动式pocscan扫描神器搭建

    1.搭建环境: 操作系统为:ubuntu16.04 x64位系统,内核版本3.0.10以上 2.安装docker镜像 root@backlion-virtual-machine:/# apt-get ...

  3. php扩展库 说明

    1 zlib是提供数据压缩用的函式库, 2 libxml2 Libxml2 is the XML C parser and toolkit developed for the Gnome projec ...

  4. 【bzoj3672】购票

    Portal -->bzoj3672 Solution 天知道我是怎么调完的qwq调到天昏地暗系列.. ​ 不管这么多,先尝试列一个最简单的状态转移方程 用\(f[i]\)表示\(i\)点到\( ...

  5. dTree 动态生成树

    http://luohua.iteye.com/blog/451453 dTree 主页:http://destroydrop.com/javascripts/tree/ dTree是个很方便在页面生 ...

  6. winform布局 FlowLayoutPanel的控件

    http://www.cnblogs.com/moon-mountain/archive/2011/09/08/2171232.html 1.采用流布局:工具箱里边容器里有一个:FlowLayoutP ...

  7. selenium - switch_to_alert() - 警告框处理

    在WebDriver中处理JavaScript所生成的alert.confirm以及prompt十分简单,具体做法是使用 switch_to.alert 方法定位到 alert/confirm/pro ...

  8. Codeforces Round #419 (Div. 2) A B C 暴力 区间更新技巧 +前缀和 模拟

    A. Karen and Morning time limit per test 2 seconds memory limit per test 512 megabytes input standar ...

  9. thinkphp常见问题

    1.数据库查询中execute和query方法的区别 tp中execute()和query()方法都可以在参数里直接输入sql语句. 但是不同的是execute()通常用来执行insert或者upda ...

  10. bzoj 1030 AC自动机+dp

    代码: //先把给的单词建AC自动机并且转移fail,然后d[i][j]表示构造的文章到第i位时处在字典树的第j个节点的不包含单词的数量,最后用总的数量26^m //-d[m][0~sz]即可.其中不 ...