Skip to content

Commit

Permalink
Require Node.js 10
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 21, 2020
1 parent 08f8cdb commit 7ed8312
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 23 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
os: osx
language: node_js
node_js:
- '14'
- '12'
- '10'
- '8'
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ declare namespace termImg {
}

declare const termImg: {
UnsupportedTerminalError: typeof UnsupportedTerminalErrorClass;

/**
Get the image as a `string` that you can log manually.
Expand All @@ -41,8 +43,6 @@ declare const termImg: {
image: string | Buffer,
options?: termImg.Options<FallbackType>
): string | FallbackType;

UnsupportedTerminalError: typeof UnsupportedTerminalErrorClass;
};

export = termImg;
2 changes: 1 addition & 1 deletion index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {UnsupportedTerminalError} from '.';
expectType<string>(termImg('/foo/bar.jpg'));
expectType<string>(termImg(Buffer.alloc(1)));
expectType<string>(termImg('/foo/bar.jpg', {width: 1}));
expectType<string | boolean>(
expectType<string | false>(
termImg('/foo/bar.jpg', {fallback: () => false})
);

Expand Down
2 changes: 1 addition & 1 deletion license
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
"description": "Display images in iTerm",
"license": "MIT",
"repository": "sindresorhus/term-img",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=8"
"node": ">=10"
},
"scripts": {
"test": "xo && ava && tsd"
Expand Down Expand Up @@ -46,9 +47,9 @@
"iterm2-version": "^4.1.0"
},
"devDependencies": {
"@types/node": "^12.0.7",
"@types/node": "^14.0.4",
"ava": "^2.0.0",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"tsd": "^0.11.0",
"xo": "^0.30.0"
}
}
19 changes: 6 additions & 13 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# term-img [![Build Status](https://travis-ci.org/sindresorhus/term-img.svg?branch=master)](https://travis-ci.org/sindresorhus/term-img)
# term-img [![Build Status](https://travis-ci.com/sindresorhus/term-img.svg?branch=master)](https://travis-ci.com/github/sindresorhus/term-img)

> Display images in iTerm
Expand All @@ -10,14 +10,12 @@ Even [animated gifs](https://github.com/vdemedes/gifi)!

*Currently only supported on [iTerm >=3](https://www.iterm2.com/downloads.html).*


## Install

```
$ npm install term-img
```


## Usage

```js
Expand All @@ -30,10 +28,9 @@ function fallback() {
console.log(termImg('unicorn.jpg', {fallback}));
```


## API

### termImg(image, [options])
### termImg(image, options?)

Get the image as a `string` that you can log manually.

Expand All @@ -45,6 +42,8 @@ Filepath to an image or an image as a buffer.

#### options

Type: `object`

##### width
##### height

Expand All @@ -59,22 +58,16 @@ The width and height are given as a number followed by a unit, or the word `'aut

##### preserveAspectRatio

Type: `boolean`<br>
Type: `boolean`\
Default: `true`

##### fallback

Type: `Function`<br>
Type: `Function`\
Default: `() => throw new UnsupportedTerminalError()`

Enables you to do something else when the terminal doesn't support images.


## Related

- [term-img-cli](https://github.com/sindresorhus/term-img-cli) - CLI for this module


## License

MIT © [Sindre Sorhus](https://sindresorhus.com)

0 comments on commit 7ed8312

Please sign in to comment.