Skip to content

Commit

Permalink
resolve vulnerability
Browse files Browse the repository at this point in the history
  • Loading branch information
dario committed Feb 5, 2020
1 parent c1a9367 commit 0d9affb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
8 changes: 7 additions & 1 deletion index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion index.ts
@@ -1,5 +1,6 @@
import { exec } from 'child_process'
import { stat } from 'fs'
import { reject } from 'bluebird'

export interface IFFFormat {
filename: string
Expand Down Expand Up @@ -116,7 +117,7 @@ export function ffprobe(file: string): Promise<IFfprobe> {
if (!file) throw new Error('no file provided')

stat(file, (err, stats) => {
if (err) throw err
if (err) return reject(new Error('wrong file provided'))

exec('ffprobe -v quiet -print_format json -show_format -show_streams ' + file, (error, stdout, stderr) => {
if (error) return reject(error)
Expand Down Expand Up @@ -146,6 +147,16 @@ export function createMuteOgg(
options: { seconds: number; sampleRate: number; numOfChannels: number }
) {
return new Promise<true>((resolve, reject) => {
if (!outputFile || !options || !options.seconds || !options.sampleRate || !options.numOfChannels)
return reject(new Error('malformed props to createMuteOgg'))

if (
!Number.isInteger(options.seconds) ||
!Number.isInteger(options.sampleRate) ||
!Number.isInteger(options.numOfChannels)
)
return reject(new Error('malformed numerico options prop for createMuteOgg'))

const ch = options.numOfChannels === 1 ? 'mono' : 'stereo'

exec(
Expand Down

0 comments on commit 0d9affb

Please sign in to comment.