Skip to content

iWillBanU/node-banusave

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-banusave

Node.js encoder and decoder for BanUSave, the save fie format used by iWillBanU's games.

Usage

Import the Library

// CommonJS
const banusave = require("banusave");

// ESM
import banusave from "banusave";

// TypeScript
import * as banusave from "banusave";

Encode JSON data

const data = {
    name: "John Doe", 
    age: 42, 
    address: {
        street: "123 Main St", 
        city: "Anytown", 
        state: "CA"
    }
};

const encoded = banusave.encode(data, "gameID");
console.log(encoded);
// <Buffer 42 41 4e 55 53 41 56 45...>

// Write it to a file
fs.writeFileSync("save.bsve2", encoded);

Decode BanUSave data

// Read the file data
const encoded = fs.readFileSync("save.bsve2");

const decoded = banusave.decode(encoded);
console.log(decoded);
// [{name: "John Doe", age: 42...}, "gameID"]

Created by iWillBanU. Licensed under the MIT license.

About

Encoder and decoder for the BanUSave format.

Resources

License

Stars

Watchers

Forks

Packages

No packages published