node package manager


deckstrings for Hearthstone

Travis npm

Decode and encode Hearthstone deckstrings.

Any deckstring or deck definition returned by this library will be canonical. This means that the cards and heroes are sorted in ascending order by dbf id.

A mapping between dbf ids and cards can be found at HearthstoneJSON.


Install the package from npm using your favourite package manager:

$ yarn add deckstrings


import {encode, decode} from "deckstrings";
const deck = {
    cards: [[1, 2], [2, 2], [3, 2], [4, 1]], // [dbfid, count] pairs
    heroes: [7], // Garrosh Hellscream
    format: 1, // 1 for Wild, 2 for Standard
const deckstring = encode(deck);
console.log(deckstring); // AAEBAQcBBAMBAgMA
const decoded = decode(deckstring);
console.log(JSON.stringify(deck) === JSON.stringify(decoded)); // true