JSPM

@confuzzle/writepuz

1.2.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 212
  • Score
    100M100P100Q96300F
  • License MIT

Minimal .puz format writer

Package Exports

  • @confuzzle/writepuz

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@confuzzle/writepuz) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@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);