Last active
March 4, 2020 10:11
-
-
Save tana3n/93c740b850c928b96d06412080ef6c47 to your computer and use it in GitHub Desktop.
https://github.com/rndomhack/ts-drop-splitter に出力時にフォルダ作ってからそっちに吐くようにするためのパッチ(git bashのdiffで作成)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- splitter.js 2017-01-08 21:23:16.000000000 +0900 | |
| +++ splitter_diff.js 2020-03-04 18:52:38.803524800 +0900 | |
| @@ -126,9 +126,15 @@ class Splitter { | |
| const size = fs.statSync(this.options.input).size; | |
| let bytesRead = split[0]; | |
| let count = 0; | |
| - | |
| + var outputdir=`${path.basename(this.options.output, path.extname(this.options.output))}_splitted\\` | |
| + fs.access(outputdir,fs.constants.F_OK, (err) => { | |
| + try{ | |
| + fs.mkdirSync(outputdir); | |
| + } catch (err){ | |
| + } | |
| + }); | |
| const readableStream = fs.createReadStream(this.options.input, { start: split[0], end: split[1] }); | |
| - const writableStream = fs.createWriteStream(path.join(path.dirname(this.options.output), `${path.basename(this.options.output, path.extname(this.options.output))}_splitted_${index + 1}${path.extname(this.options.output)}`)); | |
| + const writableStream = fs.createWriteStream(path.join(path.dirname(this.options.output),outputdir ,`${index + 1}${path.extname(this.options.output)}`)); | |
| const transformStream = new stream.Transform({ | |
| transform: function (chunk, encoding, done) { | |
| bytesRead += chunk.length; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment