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

@jimdo/md5-loader

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jimdo/md5-loader

returns md5 hash of a specified path

  • 0.1.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
9
Maintainers
3
Weekly downloads
 
Created
Source

#md5-loader

The md5 loader lets you import the checksum of a directory as a variable.

Potential use case

In a redux app there is the chance you want to persist the store or parts of it in the localStorage/sessionStorage and rehydrate your app on page-reload or a later session. However this means you may get very old data from the store if your app has changed significantly in the mean time. Therefore you need some kind of versioning in the localStorage/sessionStorage.

The md5-loader allows you to get the md5-checksum of e.g. your reducer-directory, so everytime a reducer changes, the version for the store will change. This allows you to check on rehydration if the versions match and reject or migrate the stored state.

Parameters

As webpack tries to import content before passing them to the loader you cant specify the directory like you would be used in a normal loader. Instead you should use the md5-loader inline and specify the path to the directory as a loader query-parameter. As there is no actual file required the loader also does not get the context in which it is running, thus you must specify the path to the directory absolute from the root of your project (where your node_modules live etc.).

Example

var checksum = require('md5-loader?path=some/path/from/root/of/project!');
console.log(checksum);
// logs the md5-checksum of the above directory

FAQs

Package last updated on 20 Jul 2016

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