Skip to content

darkobits/lolcatjs

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

81 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

This is a fork of lolcatjs, which itself is a Node port of the lolcat Ruby gem.

Install

npm install --global @darkobits/lolcatjs

Use (CLI)

Use (Node)

If you just want to synchronously transform a plain string, use the static fromString method on the Printer class:

import Printer from '@darkobits/lolcatjs';
const input = 'The quick brown fox\njumps over the\nlazy dog.';
const transformed = Printer.fromString(input);

If you need to do more exotic things, like transform streams and/or files, you'll want to instantiate a new Printer:

import Printer from '@darkobits/lolcatjs';

// Create a new printer.
const printer = new Printer();

// The printer can accept input from strings:
printer.fromString('The quick brown fox jumps over the lazy dog.');

// Or streams (async):
await printer.fromStream(getReadableStreamSomehow());

// Or files (async):
await printer.fromFile('/path/to/muh/file.txt');

// (Or all of the above, in any combination.)

// Output can be read by calling toString():
console.log(printer.toString());

// Or by using the printer in an interpolated string literal:
console.log(`Output: ${printer}`);

// Or, you can pipe it to a writable stream:
printer.stream.pipe(process.stdout);


About

๐ŸŒˆ๐Ÿ˜ธ For the lulz.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 76.4%
  • JavaScript 23.6%