1.0.3 • Published 4 years ago

vue-electron-local-cache v1.0.3

Weekly downloads
16
License
-
Repository
-
Last release
4 years ago

vue-electron-local-cache

This package is for electron apps. When you safely want to cache images, videos ect. and you won't use the IndexedDB - this is your choice. (IndexedDB only lasts for 50MB)

Usage

It is very simple to use this package. Make sure, electron-renderer is added to the vue-project. Follow these steps:

  1. Install the package with the command-line:
npm install vue-electron-local-cache
  1. Add the plugin to your background.js:
require('./plugin/index').init({
    ...options
})
  1. Configure following parameters (listed are defaults):
let options = {
    directory: 'C:/Folder/',
    replaceOldFile: true, // replaces old file without prompt or warning
    saveAsDialog: false,
}
  1. Provide online-ressource to cache (custId is to distinguish the different caches)
import {ipcRenderer} from 'electron';

ipcRenderer.send('item-cache', {url: 'https://www....', custId: 'TITLE001'})
  1. Listen to following events:
import {ipcRenderer} from 'electron';

ipcRenderer.on('item-removed', (event, args) => {
    // ... args = { source: '...', destination: '...' }
})
ipcRenderer.on('item-download-initialised', (event, args) => {
    // ... args = { source: '...', destination: '...' }
})
ipcRenderer.on('item-download-success', (event, args) => {
    // ... args = { source: '...', destination: '...' }
})
  1. That's it. This plugin can't do anything else.

Development

Feel free to fork this project and/or contribute to this repository. This codebase will be improved, but no more major features will be active added.

Used packages

In this repo, there are several packages used:

  • vue.js
  • vue/cli
  • babel
  • eslint