https://github.com/squat/acatiris
An ASCII Art Middleware for Express
https://github.com/squat/acatiris
Last synced: about 1 year ago
JSON representation
An ASCII Art Middleware for Express
- Host: GitHub
- URL: https://github.com/squat/acatiris
- Owner: squat
- License: mit
- Created: 2014-09-03T04:48:20.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-03-03T19:18:14.000Z (over 11 years ago)
- Last Synced: 2025-03-13T09:57:47.087Z (over 1 year ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# acatiris
Acatiris (pronounced a cat iris, an anagram of ASCII art), is an ASCII art middleware for Express. You can use Acatiris at the end of your application's middleware stack to convert all the images in your HTML into ASCII, or as a controller to create an ASCII art endpoint.
## Installation
Install with [npm](http://npmjs.org):
$ npm install acatiris
Acatiris needs the [jp2a](http://csl.name/jp2a/) and [Imagemagick](http://www.imagemagick.org/) CLI tools installed and available on the system's $PATH in order to run.
For example:
* on OS X you can install the dependencies with [Homebrew](http://brew.sh/) by running: `$ brew install jp2a imagemagick`
* on Ubuntu/Debian you can install the dependencies with `apt-get`: `$ sudo apt-get install jp2a libmagick++-dev`
## Example
### Middleware
To convert the images in your application's HTML into ASCII, put Acatiris at the end of your middleware stack:
````js
// Import Acatiris.
var acatiris = require('acatiris');
// Create a sample endpoint.
app.get('/', function(req, res, next){
res.body = 'hit me up @lsvx
';
next();
});
app.use(acatiris);
/*
Will output:
hit me up @lsvx
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
......................,llll.......;cooooc;........
......................lKKKK'....l0KKKKKKKK0o......
......................lKKKK'...oKKK0o::lOKkl'.....
......................lKKKK'...OKKKk.....'........
......................lKKKK'...lKKKKOo:'..........
......................lKKKK'....:OKKKKKK0dc'......
......................lKKKK'......,cxOKKKKK0d.....
......................lKKKK'..........':dKKKKx....
...............'c'....oKKKK'...,ld'......xKKKK....
.............:OKK0dcco0KKKx...kKKK0xlcclxKKKKd....
..............lOKKKKKKKK0o.....ckKKKKKKKKKKOc.....
................,cloooc;..........;cloool:'.......
..................................................
..................................................
*/
````
### Endpoint
To add an ASCII art endpoint to your application, simply include Acatiris like you would and controller:
````js
// Import Acatiris.
var acatiris = require('acatiris');
app.use('/ascii', acatiris.endpoint);
````
Now, a requests to `lsvx.com/ascii/`, such as [http://lsvx.com/ascii/http://o-dub.com/images/rapcat.jpg](http://lsvx.com/ascii/http://o-dub.com/images/rapcat.jpg) will generate something sweet.
## License
MIT