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

permacache

v1.0.8

Published

Creates a fast access cache in RAM and an optional permanent cache in AWS S3 bucket or the file system

Downloads

0

Readme

permacache

Installation

npm install permacache

File System:

For long term storage you can use the file system or s3 buckets. File system is faster but if there is a lot of data S3 may be a lot cheaper and scales automatically

const Cache=require('permacache');
let cache=new Cache({
    longterm:   "tests/temp"
});
let hash=await cache.put(someBuffer,'optional_path');
console.log(await cache.getByHash(hash));
console.log(await cache.getByPath('optional_path'));

S3 setup

Amazon AWS s3 is a very cost effective way to create really large permanent caches. If you already have an AWS account here are the instructions to setup. Keep in mind Amazon may change the layout of there site at any time so if the instructions don't work exactly look around for what they may have changed.

Create a bucket
1. Click Services in top left corner then select S3 under Storage
2. Click blue "Create bucket" button
3. Give your bucket a name.
4. Set the region to the same as your server.
5. Press Create
6. Note down the bucket name you will need that later
Create a user
1. Click Service in top left corner then select IAM under Security, Identity, & Compliance
2. Click on Users
3. Click blue "Add user" button
4. Assign a user name
5. select Programmatic access
6. click blue "Next: Permissions button"
7. click blue "Next: Tags"
8. click blue "Next: Review"
9. click blue "Create user"
10. note down "Access key ID" and "Secret access key" you will need that later
Assign a user to the bucket
1. Click Service in top left corner then select IAM under Security, Identity, & Compliance
2. Click on Users
3. Click on the user you wish to assign to the bucket
4. CLick on "+ Add inline policy"
5. Select Service S3
6. Select Actions "Read: GetObject" and "Write: PutObject"
7. If want to use the clear option select actions "Access level: ListBucket" and "Write: DeleteObject"
8. When Resource, Specific is select click "Add ARN" 
9. Enter the bucket you wish to use and put * for the Object name then press Add
10. Press blue "Review Policy" button
11. Give the policy a name
Usage
const Cache=require('permacache');
let cache=new Cache({
    longterm:   {
        accessKeyId: "Value from above",
        secretAccessKey: "Value from above",
        bucket: "Value from above"
    }
});
let hash=await cache.put(someBuffer,'optional_path');
console.log(await cache.getByHash(hash));
console.log(await cache.getByPath('optional_path'));