Skip to content

Commit

Permalink
udpated copy to support file-less output
Browse files Browse the repository at this point in the history
  • Loading branch information
inlife committed Feb 8, 2019
1 parent 7e83792 commit c116d18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ The reason is that we haven't defined any actions that we need to do after we fi
{
"module": "@nexrender/action-encode",
"preset": "mp4",
"output": "encoded."
"output": "encoded.mp4"
},
{
"module": "@nexrender/action-copy",
Expand Down
5 changes: 5 additions & 0 deletions packages/nexrender-action-copy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ module.exports = (job, settings, { input, output }, type) => {
if (!path.isAbsolute(input)) input = path.join(job.workpath, input);
if (!path.isAbsolute(output)) output = path.join(job.workpath, output);

/* output is a directory, save to input filename */
if (path.dirname(output) === output) {
output = path.join(output, path.basename(input));
}

/* plain asset stream copy */
const rd = fs.createReadStream(input)
const wr = fs.createWriteStream(output)
Expand Down

0 comments on commit c116d18

Please sign in to comment.