//第三题

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. Eclipse在线安装spring-tool-suit插件

    查看eclipse版本:Help–>About Eclipse;如图1所示. 访问http://spring.io/tools/sts/all,复制在线安装url地址,不要下载ZIP文件,复制链 ...

  2. 洛谷U14667 肝活动【比赛】 【状压dp】

    题目描述 Yume 最近在玩一个名为<LoveLive! School idol festival>的音乐游戏.他之所以喜欢上这个游戏,是因为这个游戏对非洲人十分友好,即便你脸黑到抽不出好 ...

  3. Flash 0day CVE-2018-4878 漏洞复现

      0x01 前言 Adobe公司在当地时间2018年2月1日发布了一条安全公告: https://helpx.adobe.com/security/products/flash-player/aps ...

  4. Extjs treePanel过滤查询功能【转】

    Extjs4.2中,对于treeStore中未实现filterBy函数进行实现,treestore并未继承与Ext.data.Store,对于treePanel的过滤查询功能,可有以下两种实现思路: ...

  5. bundle adjustment原理(1)转载

    转自菠菜僵尸 http://www.cnblogs.com/shepherd2015/p/5848430.html bundle adjustment原理(1) 那些光束平差的工具,比如SBA.SSB ...

  6. 美化mfc界面,给mfc界面加上皮肤

    注明:里面使用到的资源文件在自己的腾讯微云有. 原图: 添加皮肤后: 通过对比就能知道,加上皮肤后给人的感觉就是耳目一新了. 技术详细说明: 这里用到的是一个轻量型的美化工具SkinSharp又称Sk ...

  7. NYOJ--703

    原题链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=703 分析:先考虑不受限制的情况,此时共可以修n*(n-1)/2条隧道:所有的place组 ...

  8. Kruskal-Wallis test

    sklearn实战-乳腺癌细胞数据挖掘(博主亲自录视频) https://study.163.com/course/introduction.htm?courseId=1005269003&u ...

  9. c# extern 关键字

    TEST.DLL 项目引用TEST.DLL 调用其中的方法 结果如下:

  10. OpenCV---其他形态学操作

    一:顶帽实现(原图像与开操作图像的差值) import cv2 as cv import numpy as np def top_hat_demo(image): gray = cv.cvtColor ...