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

fpaste

v0.1.2

Published

Node utility and CLI for fedora's fpaste.org

Downloads

5

Readme

node-fpaste

Simple node utility for the RESTful fpaste.org API. Simplifies public, private and password-protected posts and gets. Includes a CLI.

Note: fpaste rate limits to prevent spam.

Installation

For use in a project:

$ npm install --save fpaste
var fpaste = require("fpaste");

For use on the command line:

$ npm install -g fpaste

API

Basic usage

Require it in your project:

var fpaste = require("fpaste");

Make a paste:

fpaste.post("This is my paste", function(err, res){
	console.log(res.url);
	// => http://fpaste.org/123456
});

Retrieve a paste:

fpaste.get(123456, function(err, res){
	console.log(res.result.data);
	// => "This is my paste"
});

List recent public pastes:

fpaste.list(function(err, res){
	console.log(res.result.pastes);
	// => [{"name": "paste_1", id: "123456"}...]
});

#post(options, cb)

Options can be a data string or an options object. Options:

  • data: String. Content of paste. Required.
  • lang: String. Language of data. Defaults to "text".
  • user: String. Username to use. Doesn't require registration. Defaults to "Anonymous".
  • password: String. Password protect a paste. Doesn't require registration.
  • private: Boolean. Mark as private. If password is provided, this is set by default.
  • expire: Number. Time in seconds after which paste will be deleted. Defaults to 0, meaning don't delete.
  • project: Name of project to associate it with.

#get(options, cb)

Options can be an ID (string or int) or an options object. Options:

  • id: Id of paste to retrieve. Required.
  • hash: Hash of paste, if paste is private.
  • password: Password if required.

#list([options], cb)

Options can be a page number, an options object, or left out. Options:

  • page: Page number. Defaults to 1.
  • project: Specify if you want a project list. If null, list will be for all public pastes.

CLI

Installation:

$ npm install -g fpaste

fpaste commands return the full fpaste.org response if the -v / --verbose flag if used.

Basic example usage

Uploading a file:

$ fpaste example.md

The above echo's an URL, so piping it straight to the clipboard is useful.

$ fpaste example.md | clip	# Windows
$ fpaste example.md | xclip		# Linux
$ fpaste example.md | pbcopy	# OSX

Getting a paste's contents:

$ fpaste -i 123456

Posting to fpaste

Upload a file by relative path.

$ fpaste {filepath}

Flags:

  • -f / --file: Specify file path more verbosely.
  • -e / --expire: Paste expiry in seconds.
  • -u / --user: Username. Doesn't require registration. Defaults to "Anonymous".
  • -p / --password: Password. Doesn't require registration.
  • --private: Private. Set by default if password is supplied.
  • --project: Project name to associate paste with.

Retrieving a paste

Retrive a post by ID.

$ fpaste -i {id}

Flags:

  • -i / --id: ID of paste to retrieve. Required.
  • -h / --hash: Hash of paste if private.
  • -p / --password: Password of paste if required.

License

MIT licensed. Written by me, Richard Foster. Do what you like with it. Thanks to Fedora!