-1

I have a nodejs project. Within this project, I installed a package via npm install youtube-dl --save. So, I not got a ./SuperProject/node_modules/youtube-dl/ directory, whom content is something such as :

|-/bin
   +- youtube-dl       <--- what is that thing ?
|-/example
|-/lib
   +- youtube-dl.js    <--- core code and executable ... i guess
|-/scripts
|-/test
|-LICENSE
|-package.json
|-README.md

I inspect around, and I see that I could edit ./node_modules/youtube-dl/lib/youtube-dl.js, by adding one condition to this package's main file :

if (options.format) {
    args.push('--sub-format=' + options.format);
}

I instinctively and boldly add this lines to ./node_mudules/youtube-dl/lib/youtube-dl.js.

Back to root, I relaunch my script :

cd ../../SuperProject
node superproject.js

I see no change in my output. Was I right to edit ./node_modules/youtube-dl/lib/youtube-dl.js ? Or is ./node_modules/youtube-dl/bin/youtube-dl the real deal to edit ?

Hugolpz
  • 17,296
  • 26
  • 100
  • 187
  • https://stackoverflow.com/questions/13300137/how-to-edit-a-node-module-installed-via-npm – Hugolpz Sep 19 '18 at 16:00
  • 1
    Is the package really named `superflash`? There is no package with that name on the public npm repository. Ideally, one would fork the dependency and make this one depend on a patched version. – E_net4 Sep 19 '18 at 16:53
  • That's a dummy name so to make the question shorter. Real package is this https://github.com/przemyslawpluta/node-youtube-dl but the question is more generic. – Hugolpz Sep 19 '18 at 19:09
  • 1
    Still, I believe the question would benefit from a more accurate example, so as to better reproduce the issue. – E_net4 Sep 20 '18 at 09:26
  • @E_net4: Done. It's `youtube-dl` for me : ) – Hugolpz Sep 20 '18 at 13:53

1 Answers1

0

Yes, edit youtube-dl/lib/youtube-dl.js. A console.log('hello world') there can proves you that it is the right file to edit. I have no idea what is the youtube-dl/bin/youtube-dl about.

Hugolpz
  • 17,296
  • 26
  • 100
  • 187