Skip to content

Commit

Permalink
Merge pull request #42 from ZJONSSON/home-directory
Browse files Browse the repository at this point in the history
replace tilde with homedir
  • Loading branch information
ZJONSSON authored Jul 19, 2024
2 parents 9c561db + 2ab293a commit 515f6ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "etl-cli",
"version": "0.1.7",
"version": "0.1.8",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
9 changes: 7 additions & 2 deletions targets/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ const renameAsync = Bluebird.promisify(fs.rename);
const utimesAsync = Bluebird.promisify(fs.utimes);
const fstream = require('fstream');
const convert = require('./lib/convert');
const path = require('path');
const os = require('os');

module.exports = async function(stream, argv) {
const filter_files = argv.filter_files && new RegExp(argv.filter_files);
const target_dir = argv.target_dir;
let target_dir = argv.target_dir;
if (!target_dir) throw 'Not target_dir';
if (target_dir.startsWith('~')) {
target_dir = path.join(os.homedir(), target_dir.slice(1));
}
let files = new Set([]);


Expand All @@ -20,7 +25,7 @@ module.exports = async function(stream, argv) {
return stream;
})
.pipe(etl.map(argv.concurrency || 1, async d => {
const Key = `${target_dir}/${d.filename}`;
const Key = path.join(target_dir, d.filename);
if (files.has(Key)) return { message: 'skipping', Key };
if (filter_files && !filter_files.test(Key)) return { message: 'ignoring', Key };

Expand Down

0 comments on commit 515f6ff

Please sign in to comment.