@confuzzle/writepuz

1.2.3 • Public • Published

@confuzzle/writepuz

This package is for writing .puz format files. For a full reader, writer, and parser, see @confuzzle/puz-crossword.

Functionality

This package provides a single function writepuz(puz), which takes a puz object (described below) and returns a Uint8Array of its corresponding .puz representation.

const puz = {
   title: "...",
   author: "...",
   copyright: "...",
   note: "...",
   width: 15,
   height: 15,
   clues: ["clue 1", "clue 2", ...],
   solution: "ABC...",
   state: "A--..."
}

All fields have meanings as described by the .puz file format. The state field is optional.

Example Usage

const fs = require('fs');
const readpuz = require('@confuzzle/readpuz').readpuz;
const writepuz = require('@confuzzle/writepuz').writepuz;
const puz = readpuz(fs.readFileSync("test.puz"));
puz.title = "A new title";
const puzbytes = writepuz(puz);
const puz2 = readpuz(puzbytes);
console.log(puz2.title);

Dependents (2)

Package Sidebar

Install

npm i @confuzzle/writepuz

Weekly Downloads

128

Version

1.2.3

License

MIT

Unpacked Size

4.98 kB

Total Files

3

Last publish

Collaborators

  • rjkat