Socket
Socket
Sign inDemoInstall

@confuzzle/puz-crossword

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@confuzzle/puz-crossword

.puz crossword reader, writer, and parser


Version published
Weekly downloads
11
decreased by-42.11%
Maintainers
1
Weekly downloads
 
Created
Source

@confuzzle/puz-crossword

This package is for reading, writing, and parsing .puz format files. It contains a single class, PuzCrossword. For standalone reading or writing, see also:

  • @confuzzle/readpuz
  • @confuzzle/writepuz

Methods

  • PuzCrossword.from(x) - equivalent to Buffer.from(x), reads .puz file from x and returns a new PuzCrossword.
  • toBytes() - returns a Uint8Array containing this crossword in .puz binary format
  • toBuffer() - returns a Buffer containing this crossword in .puz binary format

Fields

PuzCrossword objects have the following fields as defined in the .puz file format. They are all strings unless otherwise specified.

  • title
  • author
  • copyright
  • note
  • width - integer
  • height - integer
  • clues - array of strings
  • solution
  • state

In addition to these, there are the following fields:

  • hasState - boolean indicating whether state is all blank squares
  • parsedClues - array of parsed clue objects

There is no clue numbering explicitly encoded in the .puz file format, so parsed clues are provided as a convenience. Here is an example of a parsed clue object.

{
  number: 42,
  text: 'The ultimate question',
  solution: 'GFOPIOFJ',
  state: '--------',
  row: 9,
  col: 0,
  isAcross: true,
  length: 8
}

Example Usage

const PuzCrossword = require('@confuzzle/puz-crossword').PuzCrossword;
const fs = require('fs');
const cw = PuzCrossword.from(fs.readFileSync("test.puz"));
cw.title = "A new title"
const cw2 = PuzCrossword.from(cw.toBytes());
console.log(cw2.title)

Limitations

The solution in the above clue is scrambled, unscrambling is not yet implemented. Other .puz features such as rebuses and timers have also not yet been implemented.

Keywords

FAQs

Package last updated on 07 Jan 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc