Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dogchef-be/nuxt-secure-files
🔐 Embed images and download files securely via API requests
https://github.com/dogchef-be/nuxt-secure-files
ajax api-requests base64 download nuxt nuxt-module nuxtjs-ts nuxtjs-typescript typescript-support
Last synced: about 1 month ago
JSON representation
🔐 Embed images and download files securely via API requests
- Host: GitHub
- URL: https://github.com/dogchef-be/nuxt-secure-files
- Owner: dogchef-be
- License: mit
- Created: 2021-05-25T10:55:13.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-09-16T10:14:17.000Z (over 3 years ago)
- Last Synced: 2024-03-24T05:20:58.960Z (9 months ago)
- Topics: ajax, api-requests, base64, download, nuxt, nuxt-module, nuxtjs-ts, nuxtjs-typescript, typescript-support
- Language: TypeScript
- Homepage:
- Size: 244 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
nuxt-secure-files
Embed images and download files securely via API requests
## Table of contents
- [Main features](#main-features)
- [Setup](#setup)
- [Usage](#usage)
- [License](#license)## Main features
- Download Base64 files
- Directive for embedding images (WIP)
- TypeScript support## Setup
1. Add `nuxt-secure-files` dependency to your project:
```bash
npm install nuxt-secure-files
```2. Add `nuxt-secure-files` module to `nuxt.config.js`:
```js
export default {
// ...other config options
modules: ["nuxt-secure-files"];
}
```3. (Optional) TypeScript support. Add `nuxt-secure-files` to the `types` section of `tsconfig.json`:
```json
{
"compilerOptions": {
"types": ["nuxt-secure-files"]
}
}
```## Usage
1. Make sure Axios is setup, so the Authorization request header is sent. Example:
```ts
const axiosPlugin: Plugin = ({ $axios }): void => {
$axios.onRequest((config: AxiosRequestConfig): void => {
config.headers.Authorization = 'Bearer XXXXXXXXXXXXXXXX'
})
}export default axiosPlugin
```2. Use `$secDownload`:
```ts
{
methods: {
downloadFile() {
this.$secDownload('/api/file/xx', 'file_xx.pdf');
}
}
}
```## License
See the LICENSE file for license rights and limitations (MIT).