1.5.0 • Published 5 years ago
@mhirba/shenron-capsule v1.5.0
Summary
Overview
Simple package used internally at mhirba for simple utilities such as log, command line arguments parsing, etc.
Je suis adroit de la main gauche et je suis gauche de la main droite _ Raymond Devos
Installation
Use Yarn or NPM to install.
❯ yarn add @mhirba/shenron-capsule
or
❯ npm install @mhirba/shenron-capsule
Usage
Simple. Basic.
A tiny library with vanilla individual export functions:
log
Display output depending several options like colors, timestamps and newLine.
import { log, LogLevel } from '@mhirba/shenron-capsule'
log('Hello, World', { how: LogLevel.INFO, withTimestamps: true })
❯ ts-node ./main.ts
2019-10-29T21:55:40+01:00 :: Hello, World
There is also some alias logError, logWarn, logWithSteps, etc.
Scraping
Some usefull function to use specific puppeteer action with ease
download
Fetch and save a file from a web link
import { download } from '@mhirba/shenron-capsule'
await download('https://mhirba.com/nindo.pdf', './philosophy/mhirba-nindo.pdf')
❯ ts-node ./main.ts
File `mhirba-nindo.pdf` successfully saved in directory `./philosophy` !
Credits
Craft with :heart: by Mhirba in Paris.