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

phut

v0.1.0

Published

a command line interface for https://paste.sr.ht

Downloads

1

Readme

phut

A command line interface to post, share and retrieve pastes using the https://paste.sr.ht API. phut is a POSIX shell script and has only been tested on Linux. It was specifically developed as a piece of my personal development environment (which uses Alpine Linux as a base).

Usage

phut [options] [FILE] ...
... | phut [options] [FILENAME]

By default, phut creates a new paste. Using the -d option will delete a paste, the -l option will list pastes, the -r option will print a paste blob/file to stdout and -s will save the paste blob/file in the current working directory.

Options

-p: Set visibility to private.

-u: Set visibility to unlisted.

-n: Don't attach FILE names to blobs.

-e: Encrypt FILEs with gpg.

-l: List all pastes (and attached blobs).

-r BLOB: Print BLOB to stdout.

-s PASTE: Save all blobs from PASTE in current directory.

-d PASTE: Delete PASTE (and all of the attached blobs/files).

-j: Output JSON.

-a: Output ASCII.

-A: Disable ANSI escapes.

-N: Disable Nerd Font (icons).

-q: Be less verbose.

-h: Show this help menu.

Create a paste

phut [-p|-u] [-n] [-e] [-j|-q] [-a|-N] [-A] <FILE ...>

Creating a new public paste doesn't require any options and the only arguments that it takes are the files to attach. The options -p or -u can be used to make the paste private or unlisted, respectively. By default, the basename of the file (without the directory) is used as the file name. Use the -n option to disable attaching the name to the file (the name will be null in the file listing). To encrypt (using gpg --armor --symmetric) use the -e option. On success, a file tree representing the paste and attached blobs is printed to stdout. Alternatively, the response can be displayed as the original JSON sent from paste.sr.ht by using the -j option. To print just the URLs of the blobs, use the -q option. The -q flag is useful here for quickly sharing files. The rest of the options -a (ascii output), -N (no nerd font) and -A (no ansi) are available to disable unicode in the UI, disable nerd fonts, or disable ANSI escape sequences (color, bold, italics).

# create a new public paste with three files/blobs attached
phut file1.txt file2.js file3.md

# create a new private paste with no name and encrypt with gpg
phut -pen file.txt

# create a new unlisted encrypted paste with a directory and display the URL
# only (compresses the directory first using tar and gzip)
phut -ueq directory

Delete a paste

phut -d [-a|-N] [-A] [-q] <PASTE>

To delete a PASTE and all of the attached blobs (files) use the -d option. The blobs attached to the paste can't be deleted individually, so the positional argument must be the SHA1 id of the paste. Only one paste can be deleted at a time. The options -a (ascii output), -A (no ansi), -N (no nerd font) and -q (quiet) can all be used with the -d (delete) option.

phut -d aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d

List pastes

phut -l [-p|-u] [-n] [-e] [-j|-q] [-a|-N] [-A]

Print the list of pastes to stdout. The options -p, -u, -n and -e act as filters to show only private, unlisted, null named or encrypted pastes. The -q option will print a newline separated list with a URL and filename for each blob. To get the original JSON response, use the -j option. The options -a (ascii output), -A (no ansi) and -N (no nerd font) are also available to adjust the output.

# print a tree representation of all pastes
phut -l

# print the JSON request filtered to show only private pastes
phut -ljp

Read blob (file)

phut -r <BLOB>

To print a blob (file) to stdout, use the -r option along with the SHA1 id of the blob (file) to print.

phut -r aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d

Save blob (file)

phut -s [-q] [-a|-N] [-A] <PASTE>

Save all the blobs (files) from the PASTE in the current working directory.

Tips & Tricks

Quickly share a file with a link

phut -q file.txt | xclip

Move file to new paste with a different filename

phut -r aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d | phut new-name

Decrypt an encrypted blob

phut -r aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d | gpg -q

Run a paste blob (file) as a shell script with[out] args

phut -r dc2cb4d5ac2a8648cb28253eedd9696852389f0f | sh -s -- 2023 2027
phut -r 81580be9992b784cc3b94178dc7366eccec68b62 | sh