Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace Got with Axios #189

Open
Tracked by #180
vankasteelj opened this issue Feb 18, 2023 · 1 comment
Open
Tracked by #180

replace Got with Axios #189

vankasteelj opened this issue Feb 18, 2023 · 1 comment
Labels
dependencies Pull requests that update a dependency file

Comments

@vankasteelj
Copy link
Owner

In gulpfile to download mpv:

  return Promise.all(parsePlatforms().map((platform) => {
    // bundled mpv is for win only
    if (platform.match(/osx|linux/) !== null) {
      console.log('No `mpv` task for', platform)
      return null
    }

    return new Promise((resolve, reject) => {
      console.log('downloading mpv...')
      axios({
        url: pkJson.mpv.url,
        responseType: 'stream'
      }).then(response => {
        const stream = response.data
        stream.pipe(fs.createWriteStream(path.join(temp, 'mpv.7z')))
        stream.on('end', resolve)
      })
    }).then(() => {
      console.log('mpv downloaded, extracting...')
      return Z7.extractFull(path.join(temp, 'mpv.7z'), 'mpv')
    }).then(() => {
      console.log('mpv extracted')
      console.log('downloading youtube-dl...')
      return new Promise((resolve, reject) => {
        axios({
          url: pkJson.mpv['youtube-dl'],
          responseType: 'stream'
        }).then(response => {
          const stream = response.data
          stream.pipe(fs.createWriteStream('mpv/youtube-dl.exe'))
          stream.on('end', resolve)
        })
      })
    }).then(() => {
      console.log('all done.')
    })
  }))

in modules with cheerio:

axios.get(reqUrl, { timeout: 3500, responseType: 'text' }).then(res => {
    const $page = cheerio.load(res.data) ...
@vankasteelj
Copy link
Owner Author

The switch should be gradual with every step verifier. I would advise to add "axios" to the require() list then change one occurence in the main code, test it, then go on to the next one. And only remove 'got' when it is no longer used anywhere.

@vankasteelj vankasteelj mentioned this issue Mar 3, 2023
10 tasks
@vankasteelj vankasteelj added dependencies Pull requests that update a dependency file and removed enhancement labels May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

1 participant