How do I view the size of npm packages?

后端 未结 10 1757
故里飘歌
故里飘歌 2020-12-22 16:53

When I search for packages on NPM, I would like to see package sizes (in KB or MB, etc). NPM doesn’t seem to show this information.

How can I determine how much bloa

10条回答
  •  难免孤独
    2020-12-22 17:27

    I've created a tool, npm download size, which inspects tarball size for a given npm package, including all tarballs in the dependency tree. This gives you an idea of the cost (install time, disk space, runtime resources, security audit, ...) of adding the dependency up front.

    In image above, Tarball size is tar.gz of package, and Total size is size of all tarballs. The tool is pretty basic, but it does what it says.

    A cli tool is also available. You can install it like this:

    npm i -g download-size
    

    And use it like this:

    $ download-size request
    request@2.83.0: 1.08 MiB
    

    The source code is available on Github: api, cli tool and web client.

提交回复
热议问题