Socket
Socket
Sign inDemoInstall

content-hash

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

content-hash

simple tool to encode/decode content hash for EIP 1577 compliant ENS Resolvers


Version published
Weekly downloads
209K
increased by6.26%
Maintainers
1
Weekly downloads
 
Created

What is content-hash?

The content-hash npm package is used to generate content hashes for various types of content. This can be useful for caching, versioning, and ensuring data integrity.

What are content-hash's main functionalities?

Generate Hash for a String

This feature allows you to generate a hash for a given string. The hash can be used to uniquely identify the content of the string.

const contentHash = require('content-hash');
const hash = contentHash('Hello, World!');
console.log(hash);

Generate Hash for a Buffer

This feature allows you to generate a hash for a Buffer object. This is useful for binary data or files.

const contentHash = require('content-hash');
const buffer = Buffer.from('Hello, World!');
const hash = contentHash(buffer);
console.log(hash);

Generate Hash for a File

This feature allows you to generate a hash for a file by reading its contents into a Buffer and then hashing it. This is useful for ensuring file integrity.

const fs = require('fs');
const contentHash = require('content-hash');
const filePath = 'path/to/your/file.txt';
const fileBuffer = fs.readFileSync(filePath);
const hash = contentHash(fileBuffer);
console.log(hash);

Other packages similar to content-hash

Keywords

FAQs

Package last updated on 19 Nov 2019

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