Skip to content

Commit

Permalink
pipe return writeable, should use close event (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
wenerme authored Apr 29, 2020
1 parent 3cffc72 commit 464685e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ export class Migration implements RunMigration {
const newFile = `${directory}/${Date.now()}${SEPARATOR}${name}.${suffix}`

// copy the default migration template to the new file location
await new Promise((resolve) => {
await new Promise((resolve, reject) => {
// eslint-disable-next-line security/detect-non-literal-fs-filename
fs.createReadStream(path.resolve(__dirname, `../templates/migration-template.${suffix}`))
// eslint-disable-next-line security/detect-non-literal-fs-filename
.pipe(fs.createWriteStream(newFile))
.on('end', resolve)
.on('close', resolve)
.on('error', reject)
})

return newFile
Expand Down

0 comments on commit 464685e

Please sign in to comment.