Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cache-hash

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-hash

Create hash for static resources to break http cache

  • 1.0.0-beta.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Cache-hash

visitor version license

Installation

npm install cache-hash -D

Or global install

npm install cache-hash -g

Use CLI

cache-hash --target source --output public

Or

cache-hash -t source -o public

See help cache-hash --help for more configuration

$ cache-hash --help
Usage: cache-hash [options]

Options:
  -v, --version                output the version number
  -t, --target <target>        Target resource directory (default: "./")
  -o, --output <output>        Output directory, If not set, he will overwrite the "target" content
  --size <size>                Generate hash length (default: 10)
  --key <key>                  Version key (default: "v")
  --lazy <lazy>                Image lazy loading (default: "src")
  --relative <relative>        Whether to handle references to relative paths (unstable) (default: false)
  --html <html>                Generate hash for html referenced resources (default: true)
  --css <css>                  Generate hash for css referenced resources (default: true)
  --style <style>              Generating hashes for resources referenced by style tags (<style>) (default: true)
  --queryJS <queryJS>          String lookup and replacement of js file content (default: true)
  --queryScript <queryScript>  String query replacement for inline "script" tags in html file content (default: true)
  -h, --help                   display help for command

Use JavaScript API

const cacheHash = require('cache-hash')

cacheHash({
  target: 'source',
  output: 'public'
})

// Please see the cli help parameter description above
// defualtOptions: {
//   target: process.cwd(), // Current command line path
//   output: process.cwd(), // Current command line path
//   size: 10,
//   versionKey: 'v',
//   lazy: 'src',
//   relative: false,
//   html: true,
//   queryString: {
//     js: true,
//     css: true,
//     html: {
//       style: true,
//       script: true
//     }
//   }
// }

Keywords

FAQs

Package last updated on 01 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc