npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nethere

v0.1.4

Published

Download and unzip files, repos and more

Downloads

41

Readme

Nethere Logo

Bring the entire internet to you with Nethere! Nethere is a tool for downloading and unpacking files from the web, saving them to disk or just reading them in memory. All of this while still being simple to use and having no dependencies.

It is fully compatible with typescript and concurs to the ESM format.

There are currently two simple static methods; downloadToMemory and downloadToDisk.


Method downloadToMemory

This method simply downloads and unpacks (if necessary) all the URL file data and saves it to memory, so you can do whatever you like with it. This is useful when working in a browser, so you can read the file contents without saving them to disk

Method downloadToDisk

This method downloads and unpacks (if necessary) the file in the url, then saves it to disk in the given path. For zipped files the path should be a directory whereas for loose files it should be a file path.

Examples:

import { Nethere } from "nethere";

Nethere.downloadToMemory("https://link/to/my/file.tar")
  .then(result => console.log(result))
  .catch(console.error);
  /* 
    Will log something like
    [
      {
        header: {
          name: "myFile.txt",
          size: 240,
          ...
        }
        data: <Buffer>
      }
    ]
    Where 'data' is the file data and can be converted to string with 
    TextDecoder or saved to disk for example.
  */

Nethere.downloadToDisk("https://link/to/my/file.tar", "./downloaded")
  .catch(console.error);
  /* 
    Creates a directory 'downloaded' if necessary and save all extracted
    files inside such dir.
  */

Repo Download

Nethere is also able to download the files in a repository from Github, Gitlab and Bitbucket. For this you need to add a second parameter specifying the repository. Optionally you can also specify the branch to download. By default, Nethere downloads the branch master.

Nethere.downloadToMemory("https://github.com/mapikit/nethere", { repo: "github" })
  .then(result => console.log(result))
  .catch(console.error);
  /* 
    Will download and extract to memory the contents of the master branch on github
  */

Nethere.downloadToMemory("https://github.com/mapikit/nethere", { repo: "github", branch: "dev" })
  .then(result => console.log(result))
  .catch(console.error);
  /* 
    Will download and extract to memory the contents of the dev branch on github
  */

Support

URL Support

Currently Nethere supports all urls that point directly to a file or git repos (Github, Gitlab and Bitbucket).

Compressed File Support

  • .tar (Full Support)
  • .zip (Full Support)
  • .tgz (Full Support)