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 🙏

© 2026 – Pkg Stats / Ryan Hefner

serverless-toolkit

v1.3.11

Published

A collection of useful helpers for serverless functions

Readme

serverless-toolkit

npm version npm bundle size npm license

A collection of useful functions for serverless development.

Installation:

npm

npm install --save serverless-toolkit

yarn

yarn add serverless-toolkit

Error Mailer

When a function errors, receive the error via email. This is first tries to send the email via Amazon SES. If that fails it will fallback to sendmail.

Usage:

// Returns the return value of functionToWatch. If functionToWatch throws an error this will return a Promise.
// If errorHandler is supplied, it will be called once the error email has been sent and the promise will be resolved with the
// return value of errorHandler
errorMailer(functionToWatch, errorHandler, additionalInfo="", receiverEmail, senderEmail);

// alternatively you can read the environment variables of your function.
// receiverEmail defaults to process.env.ERROR_RECEIVER_EMAIL and senderEmail defaults to process.env.ERROR_SENDER_EMAIL
errorMailer(functionToWatch, errorHandler, additionalInfo="");

Example usage:

const errorMailer = require('serverless-toolkit').errorMailer;

function iWillFail(argOne, argTwo) {
  throw new Error("This failed.")
}

// this function will be called once the error email has been sent with the same arguments
function errorHandler(argOne, argTwo) {
  return Promise.reject()
}

// Remember to update receiver and sender since @example.com will often get filtered to spam
var protected = errorMailer(iWillFail, errorHandler, "This is a test", "[email protected]", "[email protected]")

protected("firstArg", "secondArg")

Example email:

An execution error occured!
Function: iWillFail

Error: This failed.
Arguments: firstArg, secondArg


Error: This failed.
    at iWillFail (/Users/example/sample/test.js:4:9)
    at replacement (/Users/example/sample/node_modules/serverless-toolkit/errorMailer/index.js:45:22)
    at Object. (/Users/example/sample/test.js:9:1)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11
"This is a test"

Dropbox storage

This is a library to easily store data in your dropbox account.

Initialization

// accessToken can also be read from "process.env.DROPBOX_TOKEN"
Storage(accessToken)

Reading Files

async fileExists(remoteFilePath)
async getTemporaryLink(remoteFilePath)
async getAllFilesInDir(remoteDirPath)
async getCsvAsObject(remoteFilePath)
async getFileAsString(remoteFilePath)

// To Filesystem
async downloadFile(remoteFilePath, localFilePath)

Writing Files

async ensureDirectoryExists(remoteFilePath) // will use the dirname of the filePath / directoryPath
async uploadText(object, remoteFileDestination)
async uploadArrayAsCSV(array, remoteCsvDestination)
async appendToCsv(newContentObject, remoteCsvDestination) // appends a single object and checks that the object has the same keys as the remote csv, otherwise an error is thrown

// From URL
// Supply headers via the customHeaders parameter like 
// { "Authorization": "Bearer abc" }
async uploadFromUrl(url, remoteFileDestination, customHeaders) 

// From Filesystem
async mergeCsv(localFilePath, remoteFilePath, primaryKey, deduplicateInputFirst=false) // this will merge two csv files based on a primaryKey (or the whole row if primaryKey is undefined or not found in the input)
async uploadFile (localFilePath, remoteFilePath)

Sample usage:

const { Storage } = require('serverless-toolkit')
let storage = new Storage()
let obj = await storage.getCsvAsObject("/test.csv")

Log Writer

Outputs function results to a specified file in Dropbox

toOutputStoringAsyncFunction(func, functionName=func.name, outputPath="/data/data-health");

Sample usage:

function testFunction() {
  return 42;
}

const newFunction = toOutputStoringAsyncFunction(testFunction)
newFunction()