# cowsay

> cowsay is a configurable talking cow

Latest version **1.6.0** (published 2024-01-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install cowsay
pnpm add cowsay
yarn add cowsay
bun add cowsay
```

Provides the commands `cowsay`, `cowthink`.

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.6.0 |
| Published | 2024-01-26 |
| First published | 2012-11-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 4 |
| Dependencies | 4 |
| Unpacked size | 484.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1322 |
| Author | Fabio Crisci |
| Maintainers | piuccio |
| Keywords | cow, cowsay, cowthink, figlet, talking, ASCII |

## Links

- npm: https://www.npmjs.com/package/cowsay
- Repository: https://github.com/piuccio/cowsay
- Issues: https://github.com/piuccio/cowsay/issues
- npm.io page: https://npm.io/package/cowsay

## Dependencies (4)

- [yargs](https://npm.io/package/yargs.md) 15.4.1
- [get-stdin](https://npm.io/package/get-stdin.md) 8.0.0
- [string-width](https://npm.io/package/string-width.md) ~2.1.1
- [strip-final-newline](https://npm.io/package/strip-final-newline.md) 2.0.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.6.0 (latest) — 2024-01-26
- 1.5.0 — 2021-05-28
- 1.4.0 — 2018-12-20
- 1.3.1 — 2018-06-10
- 1.3.0 — 2018-03-27
- 1.2.1 — 2017-08-25
- 1.2.0 — 2017-08-25
- 1.1.9 — 2016-12-06
- 1.1.8 — 2016-06-16
- 1.1.7 — 2016-06-06
- 1.1.6 — 2016-04-21
- 1.1.5 — 2016-03-31
- 1.1.4 — 2016-03-09
- 1.1.3 — 2016-01-14
- 1.1.2 — 2015-11-07
- … 6 more at https://npm.io/package/cowsay/versions

## README

# cowsay

````
 __________________
< srsly dude, why? >
 ------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
````

cowsay is a configurable talking cow, originally written in Perl by [Tony Monroe](https://github.com/tnalpgge/rank-amateur-cowsay)

This project is a translation in JavaScript of the original program and an attempt to bring the same silliness to node.js.

## Install

    npm install -g cowsay

## Usage

    cowsay JavaScript FTW!

or

    cowthink node.js is cool

It acts in the same way as the original cowsay, so consult `cowsay(1)` or run `cowsay -h`

````
 ________
< indeed >
 --------
    \
     \
                                   .::!!!!!!!:.
  .!!!!!:.                        .:!!!!!!!!!!!!
  ~~~~!!!!!!.                 .:!!!!!!!!!UWWW$$$
      :$$NWX!!:           .:!!!!!!XUWW$$$$$$$$$P
      $$$$$##WX!:      .<!!!!UW$$$$"  $$$$$$$$#
      $$$$$  $$$UX   :!!UW$$$$$$$$$   4$$$$$*
      ^$$$B  $$$$\     $$$$$$$$$$$$   d$$R"
        "*$bd$$$$      '*$$$$$$$$$$$o+#"
             """"          """""""
````

## Usage as a module

cowsay can be used as any other npm dependency
```js
const cowsay = require("cowsay");

console.log(cowsay.say({
    text : "I'm a moooodule",
    e : "oO",
    T : "U "
}));

// or cowsay.think()
```
````
 _________________
( I'm a moooodule )
 -----------------
        o   ^__^
         o  (oO)\_______
            (__)\       )\/\
             U  ||----w |
                ||     ||
````

getting a list of cow names:
```js
function get_cows(error, cow_names) {
    if (error) {
        console.log(error)
    }
    else if (cow_names) {
        console.log(`Number of cows available: ${cow_names.length}`);
    }
}

cowsay.list(get_cows);
```

#### Typescript examples:
```ts
import * as cowsay from "cowsay"

let output: string = cowsay.say({ text: 'Hello from typescript!' });

console.log(output);
```

getting a list of cow names:
```ts
function get_cows(error: NodeJS.ErrnoException, cow_names: Array<string>): void {
    if (error) {
        console.log(`Error getting cow names: ${error.message}`)
    }
    else if (cow_names) {
        console.log(`Number of cows available: ${cow_names.length}`);
    }
}

cowsay.list(get_cows);
```

importing the `IOptions` interface directly:
```ts
import { IOptions } from "cowsay" // optional

let opts: IOptions = {
    text: "Hello from TypeScript!",
    e: '^^',
    r: true,
};

console.log(cowsay.say(opts));
```


## Pipe from standard input

    echo please repeat | cowsay

## Usage in the browser

cowsay works in your browser too with rollup / webpack / browserify / you name it.

```js
import { say } from 'cowsay';

console.log(say({ text: 'grazing in the browser' }));
```

You can customize the cow by importing the relevant one

```js
import { think, SQUIRREL } from 'cowsay';

console.log(think({
  text: 'grazing in the browser',
  cow: SQUIRREL,
  eyes: 'pp',
  tongue: ';;',
}));
```

All cows are included in the bundle, but you can use rollup / webpack tree-shake feature to reduce the final bundle size.

### Browser options

```js
say({
  text: 'hello',
  cow: '', // Template for a cow, get inspiration from `./cows`
  eyes: 'oo', // Select the appearance of the cow's eyes, equivalent to cowsay -e
  tongue: 'L|', // The tongue is configurable similarly to the eyes through -T and tongue_string, equivalent to cowsay -T
  wrap: false, // If it is specified, the given message will not be word-wrapped. equivalent to cowsay -n
  wrapLength: 40, // Specifies roughly where the message should be wrapped. equivalent to cowsay -W
  mode: 'b', // One of 	"b", "d", "g", "p", "s", "t", "w", "y"
});
```

---
_Source: https://npm.io/package/cowsay · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
