
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
helps save and load game data and hiscores into ipfs. I made this intending to use it during the next ludum dare game jam.
uses the ipfs api by wrapping ipfs.add
.
npm install
make sure you have an IPFS daemon running locally, or use these environment variables to set the location of your IPFS daemon (API must be enabled and accessible)
Available environment variables:
ipfs_daemon_host
ipfs_daemon_port
ipfs_daemon_protocol
See example dir for more detailed and commented code
Save game data to IPFS
var ipfsPlay = require('ipfsPlay');
var saveData = {"level": 5};
ipfsPlay.save(saveData, function(err, key) {
if (err) return console.error(err);
// key => QmPJQv5888kUNFXLvr8duLu9De6sgGog896jBGYnBWk6f1
console.log('your game is saved! To load your game later, use the key ' + key);
}
Load game data from IPFS
var key = 'QmPJQv5888kUNFXLvr8duLu9De6sgGog896jBGYnBWk6f1';
ipfsPlay.load(key, function (err, gameData) {
if (err) return console.error('problem loading! ' + err);
var level = gameData.level;
console.log('Welcome back, player. you are on level ' + level);
});
see example directory for more detail and commented code
FAQs
IPFS helpers for saving game data
We found that ipfs-play demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.