Socket
Socket
Sign inDemoInstall

@confuzzle/puz-sharing

Package Overview
Dependencies
13
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @confuzzle/puz-sharing

.puz crossword reader, writer, and parser with compression and encoding


Version published
Maintainers
1
Created

Readme

Source

@confuzzle/puz-sharing

This package extends @confuzzle/puz-crossword, adding capabilities for compressing and converting .puz files to URL-compatible base64 and emoji. The compressed format should be treated as experimental and will not be backwards-compatible betweeen releases of this package at this stage.

This package makes use of @thi.ng/range-coder by Karsten Schmidt, part of the excellent @thi.ng umbrella library.

Contents

This package provides a single class, ShareablePuz, which extends PuzCrossword with the following additional methods:

  • ShareablePuz.toCompressed() - return a compressed representation of the crossword as raw bytes
  • ShareablePuz.toEmoji() - the compressed representation encoded using @confuzzle/ecoji-buffers
  • ShareablePuz.toURL() - the compressed representation encoded using @base64url

Each of these methods has a counterpart returning a new ShareablePuz object from its output x:

  • ShareablePuz.fromCompressed(x)
  • ShareablePuz.fromEmoji(x)
  • ShareablePuz.fromURL(x)

Example Usage

const ShareablePuz = require('@confuzzle/puz-sharing').ShareablePuz;
const fs = require('fs');
const cw = ShareablePuz.from(fs.readFileSync("test.puz"));
console.log(cw.title) // Test puzzle
const emoji = cw.toEmoji();
console.log(emoji.slice(0, 10)) // 🧩✨0️⃣🌌🇩
const cw2 = ShareablePuz.fromEmoji(emoji);
console.log(cw2.title) // Test puzzle

Keywords

FAQs

Last updated on 13 Jun 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc