Browse Source

get-files: skip file over 1mb

master
Guillermo Rauch 9 years ago
parent
commit
0a2e88351b
  1. 11
      lib/get-files.js

11
lib/get-files.js

@ -1,10 +1,13 @@
import { resolve } from 'path';
import bytes from 'bytes';
import flatten from 'arr-flatten';
import unique from 'array-unique';
import minimatch from 'minimatch';
import IGNORED from './ignored';
import { resolve } from 'path';
import { stat, readdir, readFile } from 'fs-promise';
const ONEMB = bytes('1mb');
/**
* Returns a list of files in the given
* directory that are subject to be
@ -119,11 +122,15 @@ const explode = async function (paths) {
const all = await readdir(file);
return many(all.map(subdir => asAbsolute(subdir, file)));
} else {
if (s.size > ONEMB) {
console.error(`> \u001b[31mWarning!\u001b[39m Skipping file over 1MB: ${path}`);
}
return path;
}
};
return flatten((await many(paths)));
return flatten((await many(paths))).filter((v) => null != v);
};
/**

Loading…
Cancel
Save