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

@ambi-robotics/cache

v1.3.2

Published

S3-backed action cache lib

Downloads

12

Readme

@ambi-robotics/cache

This package provides a drop-in replacement for the Github Actions cache toolkit functions, but allows for the use of S3-like storage backends (e.g. Minio) via environment variable configurations.

The work here is based in part on this github action.

Usage

Save Cache

Saves a cache containing the files in paths using the key provided. The files would be compressed using zstandard compression algorithm if zstd is installed, otherwise gzip is used. Function returns the cache id if the cache was saved succesfully and throws an error if cache upload fails.

const cache = require('@ambi-robotics/cache')
const paths = ['node_modules', 'packages/*/node_modules/']
const key = 'npm-foobar-d5ea0750'
const cacheId = await cache.saveCache(paths, key, undefined, false, {
  bucket: 'actions-cache', // required
  port: 9000, // optional, default is 9000
  endPoint: 'play.min.io', // optional, default s3.amazon.aws
  accessKey: 'ASDFJKL', // required
  secretKey: 'zud+sdfjkewf', // required
  sessionToken: 'AQoDY', // optional
  region: 'us-east-1', // optional
  useSSL: true // optional, use http instead of https
})

Restore Cache

Restores a cache based on key and restoreKeys to the paths provided. Function returns the cache key for cache hit and returns undefined if cache not found.

const cache = require('@actions/cache')
const paths = ['node_modules', 'packages/*/node_modules/']
const key = 'npm-foobar-d5ea0750'
const restoreKeys = ['npm-foobar-', 'npm-']
const cacheKey = await cache.restoreCache(
  paths,
  key,
  restoreKeys,
  undefined,
  false,
  {
    bucket: 'actions-cache', // required
    port: 9000, // optional, default is 9000
    endPoint: 'play.min.io', // optional, default s3.amazon.aws
    accessKey: 'ASDFJKL', // required
    secretKey: 'zud+sdfjkewf', // required
    sessionToken: 'AQoDY', // optional
    region: 'us-east-1', // optional
    useSSL: true // optional, use http instead of https
  }
)

Environment Variables

Rather than providing the S3 or minio configuration in each function call, you can set environment variables for the main parameters.

  • bucket: ALT_GHA_CACHE_BUCKET
  • port: ALT_GHA_CACHE_PORT
  • accessKey: ALT_GHA_CACHE_ACCESS_KEY or AWS_ACCESS_KEY_ID
  • secretKey: ALT_GHA_CACHE_SECRET_KEY or AWS_SECRET_ACCESS_KEY
  • sessionToken: ALT_GHA_CACHE_SESSION_TOKEN or AWS_SESSION_TOKEN
  • region: ALT_GHA_CACHE_REGION or AWS_REGION
  • useSSL: ALT_GHA_CACHE_USE_SSL