New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cache-busting-assets

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-busting-assets - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

15

index.js
const crypto = require('crypto');
const fs = require('fs');
const process = require('process');
const generateHash = (sourceFile) => {
const file = fs.readFileSync((`.${sourceFile}`), 'utf8');
const generateHash = (dir, sourceFile) => {
const file = fs.readFileSync((`${dir}${sourceFile}`), 'utf8');
const hash = crypto

@@ -15,2 +16,8 @@ .createHash('sha1')

const destination = sourceFile.replace(fileName, `${fileName}-${hash}`);
console.log(`${dir}${sourceFile}`, `${dir}${destination}`);
fs.copyFile(`${dir}${sourceFile}`, `${dir}${destination}`, (copyErr) => {
if (copyErr) {
throw copyErr;
}
});

@@ -20,6 +27,6 @@ return destination;

const createHashFile = (sources) => {
const createHashFile = (dir, sources) => {
const hashes = sources.map(file => (
{
[file]: generateHash(file),
[file]: generateHash(dir, file),
}

@@ -26,0 +33,0 @@ ));

{
"name": "cache-busting-assets",
"version": "0.0.1",
"version": "0.0.2",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

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