vite-plugin-naria2
TypeScript icon, indicating that this package has built-in type declarations

0.0.25 • Public • Published

vite-plugin-naria2

version CI

Make it easy to debug a aria2 client application.

Installation

npm i naria2 @naria2/node vite-plugin-naria2

Usage

// vite.config.ts

import { defineConfig } from 'vite';

import Naria2 from 'vite-plugin-naria2';
import TopLevelAwait from 'vite-plugin-top-level-await';

export default defineConfig({
  plugins: [
    TopLevelAwait(), // Used for transforming the top-level await syntax
    Naria2({
      childProcess: {
        log: './aria2.log',     // Used for debug
        environment: 'ignore',  // Ignore proxy environment variables
        rpc: {
          secret: '123456'      // Use the fixed secret, or generate under the hood
        }
      }
    })
  ]
});

Use the aria2 child process in your application code.

// main.ts

import { socket, client } from '~naria2/jsonrpc';

console.log('naria2 socket:', socket);
console.log('naria2 client:', client);

Warning

The aria2 child process only created in your development so that these exported variables will be undefined in production.

License

MIT License © 2023 XLor

Package Sidebar

Install

npm i vite-plugin-naria2

Weekly Downloads

1

Version

0.0.25

License

MIT

Unpacked Size

11.7 kB

Total Files

9

Last publish

Collaborators

  • yjl9903