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

pbiny

v1.0.2

Published

A npm package to interact with Pastebin directly from the terminal

Downloads

12

Readme

terminal Build Status Build status Codacy Badge Known Vulnerabilities Total alerts Language grade: JavaScript GitHub top language David GitHub code size in bytes NPM npm node lines npm

pbiny

A npm package to interact with Pastebin directly from the terminal

Installation

$ npm install -g pbiny

This is a platform agnostic, command line interface for pastebin.com. We recommend it to be installed globally for accessing the tool from anywhere.

Usage

This is a zero-configuration, ready to use CLI tool.

It has 4 main commands:

And 2 options (flags):

  • -h ( --help )
  • -v ( --version )

note: These 2 options (-h and -v) are available to all the commands as well

up [alias: upload]

The upload command is used to upload content (file or text) to pastebin and produces a link to the created paste.

It has 2 Data Options and 3 Configurational Options:

Notes:

  • The Configurational Options can be used with both the Data Options but are completely optional
  • Only one of the 2 Data Options should be passed to the up command
  • The up command can be used without any options. (More about it below)

up -f [alias: --file]

$ pbiny up -f "./pbiny_test/sample.txt"

The -f option of the up command is used to provide the relative or absolute path to the file which needs to be uploaded, it also supports the ~/ notation for the bash terminals.

The maximum file size is 512 KB for Guest and Normal users and 10 MB for PRO users. See Pastebin specifications here.

If some or all the Configurational Options (-n, -e, -g) are not provided then the defaults are used. The default options / settings can be seen and modified by the config command.

Initial Defaults:

  • Paste Title: undefined / untitled
  • Paste Format: text
  • Paste Expiration: N (Never)
  • Paste Privacy: 0 (Public)

This command should produce a pastebin url which points to the Paste just been created with the file contents.

Example:

up -t [alias: --text]

Single line text:

$ pbiny up -t "This is a sample post ^_^" -n "Sample Post" -e "text"

Multi Line text:

$ pbiny up  -n "Quote" -e "text" -t "\
The difference between stupidity and genius
is that genius has its limits.
--Albert Einstein"

The -t option of the up command is used to provide the text which will be uploaded to pastebin.

If some or all the Configurational Options (-n, -e, -g) are not provided then the defaults are used. The default options / settings can be seen and modified by the config command.

Initial Defaults:

  • Paste Title: undefined / untitled
  • Paste Format: text
  • Paste Expiration: N (Never)
  • Paste Privacy: 0 (Public)

This command should produce a pastebin url which points to the Paste just been created with your text.

Example:

up < -f | -t > -n [alias: --name]

$ pbiny up -t "This is a sample post ^_^" -n "Sample Post"

The -n option of the up command is optional and can be passed to both the -f and -t. This option takes a string as argument which will be used to create the name / title of the paste.

If -n is not provided then the title of the paste is set to untitled.

up < -f | -t > -e [alias: --extension]

$ pbiny up -t "This is a sample post ^_^" -e "text"

The -e option of the up command is optional and can be passed to both the -f and -t. This option takes a string as argument which will be used to set the extension / formate (syntax highlighting) of the paste.

All the valid values for -e can be found at pastebin api specifications here.

If -e is not provided then the formate of the paste is set to the value defined in config.

up < -f | -t > -g [alias: --guest]

$ pbiny up -t "This is a sample post ^_^" -e "text" -g

You can very easily login to your pastebin account using the usr command. While you are logged in, you may want to create a paste as Guest User (anonymously). The -g flag is used for this purpose only

The -g options takes a boolean i.e., it is a flag / switch and no argument is require for it.

Note: The -g flag has it's effect only when a user is logged in otherwise it has no effect.

up (without any option)

$ pbiny up

If you run the up command without any options then an interactive Paste builder will start. The paste builder will allow you to set the values for different parameter like:

  • Which type of user to use: Logged in / Guest User
  • Paste Title
  • Paste Format / Extension
  • Paste Expiration
  • Paste Privacy

After setting the parameters you will be taken to your preferred text editor to create the content of the paste. This editor options is made with the help of inquirer.js editor input and works as:

Launches an instance of the users preferred editor on a temporary file. Once the user saves and exits their editor, the contents of the temporary file are read. The editor to use is determined by reading the $VISUAL or $EDITOR environment variables. If neither of those are present, notepad (on Windows) or vim (Linux or Mac) is used.

Works great with cli test editors like nano and vim

Example:

If the editor does not work or returns nothing to create a paste then a prompt for entering data (multi-line) will be displayed.

Note: you cannot edit the previous lines in this mode.

Example:

dn [alias: download]

The download command is used to download content of a paste from pastebin and either display it or save it to a file. It also supports retrieval of private pastes of a logged in user.

It has 1 Required Option and 2 Configurational Options:

dn -u [alias: --url]

$ pbiny dn -u "pastebin.com/zSHnKsSf"

The -u option of the dn command is a required option and is used to fetch the raw content of the paste to whom the url (-u) points

The -u option takes a string as an argument. The string can be of the following formate:

  • "https://pastebin.com/xxxxxxx"
  • "pastebin.com/xxxxxxx"
  • "xxxxxxx"

where xxxxxxx is the key of the paste.

If the -f ( --file ) option is not provided the fetched data is simply displayed to the command line.

Example:

dn -u -f [alias: --file]

$ pbiny dn -u "pastebin.com/zSHnKsSf" -f "./pbiny_test/sample_out.txt"

The -f option of the dn command is used for providing the relative path to the file to which the fetched data is to be stored.

If the file extension is not provided then the default option will be used. The default options / settings can be seen and modified by the config command.

Note: The provided file path should not be taken i.e., it will not over write an already existing file.

Example:

dn -u -p [alias: --private]

$ pbiny dn -u "pastebin.com/xxxxxxx" -f "./pbiny_test/sample_out.txt" -p

Pastebin provides an option of creating a private bin i.e., only the user who created the post can view it.

the -p option of dn command allows a logged in user to view his/her private pastes by pbiny. It throws an error if the user is not logged in, the paste does not belongs to the logged in user or the paste is not private.

The -p option takes a boolean i.e., it is a flag / switch and no argument is require for it.

You can very easily login to your pastebin account using the usr command.

config [alias: configuration]

$ pbiny config

The config command is used to see the defaults set for the application. You can change all the default values by passing in the following options:

  • Upload Config:
    • --ext ( --extension or --format )
    • --exp ( --expiration )
    • --priv ( --privacy )
  • Download Config:
    • --f_ext ( --file_extension )

All these options take a boolean i.e., they are a flag / switch and no argument is require for them.

  • --ext [aliases: --extension, --format ] option is used to provide the default formate of the paste created by the up command. It is used when the up command do not provide the optional -e option. The complete list of valid extensions / format / Syntax is given here.

  • --exp [alias: --expiration ] option is used to provide the default expiration for the paste created by the up command. The complete list of valid expiration values is given here.

  • --priv [alias: --privacy ] option is used to provide the default privacy for the paste created by the up command. The complete list of valid privacy values is given here.

  • --f_ext [alias: --file_extension ] option is used to provide the default file extension for the file created by the dn command passing -f option. It can take any valid file extension like txt, js, json, py.

Syntax Example:

$ pbiny config --ext --priv --f_ext

Example:

usr [alias: user]

$ pbiny usr

The usr command is used to see the currently logged in user (User Name, Email and Account Type). This command has 2 options:

  • -l ( --login )
  • --logout

Both these options take a boolean i.e., they are a flag / switch and no argument is require for them.

  • -l [alias: --login] option allows a user to login with his / her Username and Password.

Note: If you have created your Pastebin account using Google, Facebook or Twitter then you have to set your password to use any tool build on Pastebin here: https://pastebin.com/password

  • --logout option allows a logged in user to log out of the pbiny tool.

Example: