devowlio / node-lame

LAME is an open-source encoder that encodes and decodes audio to the MP3 file format. For all MP3 needs a Node.js wrapper of the full LAME command line.
Other
81 stars 9 forks source link

ENOENT: no such file or directory ./temp/raw/... in "fileBuffer" mode (as opposed to "filePath" mode) #3

Closed PyrApple closed 7 years ago

PyrApple commented 7 years ago

reproduced bug evoked in #1, fix proposal

Creating a test-dbg.js in node-lame/test/ (see below for test-dbg.js content) and running

node test-dbg.js

from the test folder results in:

$ NODE_DEBUG=fs node dbg-tmp-path.js
fs.js:94
        throw backtrace;
        ^

Error: ENOENT: no such file or directory, unlink './temp/raw/1jToI7sLifXwqsccSzIv6bHTrtxVhpNa'
    at rethrow (fs.js:89:21)
    at makeCallback (fs.js:115:12)
    at Object.fs.unlink (fs.js:1080:14)
    at Lame.removeTempFilesOnError (/Users/.../node-lame/lib/build/Lame.js:312:22)
    at Promise.then.catch (/Users/.../node-lame/lib/build/Lame.js:138:22)

test-dbg content:

const INFILEPATH = "./example.wav";
const OUTFILEPATH = "./todelete.mp3";

const Lame = require("../index").Lame;
const fsp = require("fs-promise");

fsp.readFile(INFILEPATH)
  .then((inputBuffer) => {

    const instance = new Lame({
      "output": OUTFILEPATH,
      "bitrate": 128
    })

    instance.setBuffer(inputBuffer);
    instance.encode().then(() => { console.log('encoding over') });

  });
jankarres commented 7 years ago

Thanks for your investigation and your solution. I did not merge it, because you write the fix in the compiled JavaScript files, instead of in TypeScript files. I did a commit with the fix in TypeScript with a reference to you. Used in node-fdkaac, too.

PyrApple commented 7 years ago

Thanks, sorry for overlooking the TypeScript implementation.

On 26 Apr 2017, at 10:22, Jan Karres notifications@github.com wrote:

Thanks for your investigation and your solution. I did not merge it, because you write the fix in the compiled JavaScript files, instead of in TypeScript files. I did a commit https://github.com/jankarres/node-lame/commit/13ad74c32fa834b1a2be27b826f53db460ca7f13 with the fix in TypeScript with a reference to you. Used in node-fdkaac https://github.com/jankarres/node-fdkaac/, too.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jankarres/node-lame/pull/3#issuecomment-297286603, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIcbhqLUq2jVBVC8ig2QGqSbY0RnLK7ks5rzv7IgaJpZM4NHeve.