https://github.com/noah227/console.image
Log image in browser's console
https://github.com/noah227/console.image
Last synced: 2 months ago
JSON representation
Log image in browser's console
- Host: GitHub
- URL: https://github.com/noah227/console.image
- Owner: noah227
- Created: 2024-06-07T09:29:35.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2024-10-13T13:28:13.000Z (7 months ago)
- Last Synced: 2025-03-16T08:15:58.022Z (2 months ago)
- Language: TypeScript
- Homepage:
- Size: 50.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# console.image
## usage
### type definition
```ts
// support both callback and Promise
image: (url: string, options?: TOption, callback?: Function) => Promise
```### code example
```ts
import console from "@cynario/console.image"// console.image(url, options?)
// render image with it's default size
console.image("http://127.0.0.1/x.png")// render image with 198px as assigned width, height will be auto computed based on size ratio
console.image("http://127.0.0.1/x.png", {width: 198})// in vue, you can use it like this way
console.image(require("@/assets/x.png"))// of course, you can still use raw functions of console
console.log("hello")// extra example (Promise)
console.image("http://127.0.0.1/x.png").then(() => {
console.log("Hi there! Now you can see the image!")
})
```## example
See [example](https://noah227.github.io/console.image/).