https://github.com/slice/fling
Yet another @whats-this client in JavaScript. Tiny (almost only 40 lines total).
https://github.com/slice/fling
Last synced: 3 months ago
JSON representation
Yet another @whats-this client in JavaScript. Tiny (almost only 40 lines total).
- Host: GitHub
- URL: https://github.com/slice/fling
- Owner: slice
- Created: 2017-11-10T21:50:54.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-19T00:19:36.000Z (over 8 years ago)
- Last Synced: 2025-01-21T16:24:07.727Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fling
Another tiny client for [@whats-this](https://whats-th.is/).
## install
```sh
~> npm i slice/fling
~> yarn add slice/fling
```
## use
```js
const fling = require('fling');
const options = {
token: 'XXXX-XXXX-XXXX-XXXX-XXXX'
};
// ①: Usage with a file on disk
fling('my_file.txt', options)
.then(r => console.log(r.files[0].url)) // -> xxxxxx.txt
.catch(err => ...);
// ②: Usage with a buffer
const buffer = getABufferSomehow();
fling(buffer, options)
.then(...)
.catch(...);
// ③: Usage in an `AsyncFunction`
const task = async () => {
await fling(..., options);
};
```
## cli
A tiny CLI tool is provided for convenience. Place your token in a file at
`~/.config/owo-token` (no JSON or anything, **just** the token in the file).
```sh
~> fling file.txt
https://owo.whats-th.is/xxxxxx.txt
```