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

cheesebread

v1.4.0

Published

A delicious and easy to cook CDN file caching for offline development environments.

Downloads

41

Readme

cheesebread - Pão de Queijo

A delicious and easy to cook CDN file caching for offline development environments.

Npm Version Node Version Build Status Codacy Coverage Badge Codacy Grade Badge bitHound Overall Score bitHound Code bitHound Dependencies bitHound Dev Dependencies Code Climate

npm start

Type: http://localhost:3000/target_url where target_url is an online address, for example: http://localhost:3000/https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png

The first time you hit that URL it will download, cache and provide the file. The subsequent attempts will access from the cache.

Install and run

NPM CLI:

npm install cheesebread -g
cheesebread --help          # Command-line help
cheesebread                 # Start the server

NPM Project:

npm install cheesebread --save-dev

Starting with Express (you can add to your current application).

const http = require('http');
const express = require('express');

const cheesebread = require('cheesebread');

const options = {
  dir: 'cache', 
  externalUrl: 'localhost:3000/proxy', 
  log: true
};

const app = express(); 

app.use('/proxy', cheesebread(options)))

const server = http.createServer(cheesebread({ dir, externalUrl, log }));

server.listen(3000, '127.0.0.1', () => {
  console.log(`Cheese Bread server is listening on ${externalUrl}/`);
});

Docker:

docker pull gartz/cheesebread
docker run -p "3000:3000" gartz/cheesebread # Start docker container

Purge the cache

Delete all files from the folder: ${home}/.cheese-bread-js/cache also known as ~/.cheese-bread-js/cache

Environment options

  • PORT (3000): Define the server port
  • HOST (127.0.0.1): Define the host IP
  • CACHE_DIR (~/cheese-bread-js/cache): Define where the cache files will be saved
  • LOG (true): Display log information in the output
  • EXTERNAL_URL (http://${HOST}:${PORT}): URL used to access the server

Todo

  • Create a wildcard to white-list target URLs

Motivation and Name

We want to show a project on CES that should run offline, and we need files from CDN to be cached in our Docker local instance.

On @gartz vocation at the hotel he write this server script that would allow to accomplish the task.

To choose the name @brainTrain established that being a JS project it must have a name that isn't semantic to it. @ptubig suggested that it should be an Brazilian name, and @tjohnson4 gave the idea to call it "Pão de queijo", what we translated to Cheese Bread.

Companies using