Skip to content Skip to sidebar Skip to footer

How To Use Npm Mp3 To Wav

When attempting to convert an mp3 to wav using npm mp3-to-wav, the console returns, 'mp3 to wav exec err: saveForWav err: Path must be a string. Received [ 'C:\Projects\Weather

Solution 1:

the err you get is not from 'mp3-to-wav' its from fs there isnt any problem with your path

classMp32Wav {

      constructor(input_file_path, output_dir) {

        if (!utils.checkArgsNotNull(...input_file_path)) {
          thrownewError('err arguments')
        }
        output_dir = utils.judgeNotNull(output_dir) ? output_dir : utils.splitFileDir(input_file_path)
        this._input_file_path = input_file_path
        this._input_file_name = utils.splitFilename(input_file_path)
        this._output_dir = output_dir
        this._output_file_name = this._input_file_name.toString().replace(/\.mp3/i, '')
      }

as you can see in their constructor they ignore case sensitive

.replace(/\.mp3/i, '')

I don't use windows but I think it will be helpful for you to use path module to create your path and check if its absolute

Node.js path.isAbsolute() Method

https://www.w3schools.com/nodejs/met_path_isabsolute.asp

also, all examples in w3c use double \\ insted of \ in windows

for example

console.log(path.isAbsolute('C:\\test\\demo_path.js')); //true

Post a Comment for "How To Use Npm Mp3 To Wav"